[OpenSRF-GIT] OpenSRF branch master updated. 34038f2e3dd9a2ad6842f3593938955143213b11

Evergreen Git git at git.evergreen-ils.org
Mon Oct 31 17:24:46 EDT 2016


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "OpenSRF".

The branch, master has been updated
       via  34038f2e3dd9a2ad6842f3593938955143213b11 (commit)
      from  b6557d6a781fe7f7e16d0c5df5707ce5f8f49d48 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 34038f2e3dd9a2ad6842f3593938955143213b11
Author: Bill Erickson <berickxx at gmail.com>
Date:   Fri Jul 10 10:52:20 2015 -0400

    LP#1473479 Syslog configuration adoption
    
    When an OpenSRF client is run with syslog enabled and with the
    OSRF_ADOPT_SYSLOG environment variable set to a true value, no attempt
    is made to modify the syslog configuration, including no calls to
    openlog()/closelog() and no modification of the syslog facility when
    calling syslog().
    
    Signed-off-by: Bill Erickson <berickxx at gmail.com>
    Signed-off-by: Galen Charlton <gmc at esilibrary.com>

diff --git a/src/perl/lib/OpenSRF/Utils/Logger.pm b/src/perl/lib/OpenSRF/Utils/Logger.pm
index 4798812..157c961 100644
--- a/src/perl/lib/OpenSRF/Utils/Logger.pm
+++ b/src/perl/lib/OpenSRF/Utils/Logger.pm
@@ -85,7 +85,9 @@ sub set_config {
         $facility = $logfile;
         $logfile = undef;
         $facility = _fac_to_const($facility);
-        openlog($service, 0, $facility);
+        # OSRF_ADOPT_SYSLOG means we assume syslog is already
+        # opened w/ the correct values.  Don't clobber it.
+        openlog($service, 0, $facility) unless $ENV{OSRF_ADOPT_SYSLOG};
 
     } else { $logfile = "$logfile"; }
 
@@ -161,6 +163,7 @@ sub is_act_filelog {
 
 sub set_service {
     my( $self, $svc ) = @_;
+    return if $ENV{OSRF_ADOPT_SYSLOG};
     $service = $svc;    
     $service .= '/' . $service_tag if (defined $service_tag);    
     if( is_syslog() ) {
@@ -260,12 +263,15 @@ sub _log_message {
     # Trim the message to the configured maximum log message length
     $msg = substr($msg, 0, $max_log_msg_len); 
 
+    # avoid clobbering the adopted syslog facility
+    my $slog_flags = $ENV{OSRF_ADOPT_SYSLOG} ? $l : $fac | $l;
+
     if( $level == ACTIVITY() ) {
-        if( is_act_syslog() ) { syslog( $fac | $l, $msg ); } 
+        if( is_act_syslog() ) { syslog( $slog_flags, $msg ); }
         elsif( is_act_filelog() ) { _write_file( $msg, 1 ); }
 
     } else {
-        if( is_syslog() ) { syslog( $fac | $l, $msg ); }
+        if( is_syslog() ) { syslog( $slog_flags, $msg ); }
         elsif( is_filelog() ) { _write_file($msg); }
     }
 

-----------------------------------------------------------------------

Summary of changes:
 src/perl/lib/OpenSRF/Utils/Logger.pm |   12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)


hooks/post-receive
-- 
OpenSRF


More information about the opensrf-commits mailing list