From d8295bcd6ba64e350bb6455f5f7465e353060f35 Mon Sep 17 00:00:00 2001 From: erickson Date: Mon, 2 Jul 2007 22:07:02 +0000 Subject: [PATCH] updated the sylog and activity log file handling to accomodate differences from bootstrap.conf and opensrf_core.xml git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@991 9efc2488-bf62-4759-914b-345cdb29e865 --- src/perlmods/OpenSRF/Utils/Logger.pm | 38 ++++++++++++++++------------ 1 file changed, 22 insertions(+), 16 deletions(-) diff --git a/src/perlmods/OpenSRF/Utils/Logger.pm b/src/perlmods/OpenSRF/Utils/Logger.pm index 138aa01..8734115 100644 --- a/src/perlmods/OpenSRF/Utils/Logger.pm +++ b/src/perlmods/OpenSRF/Utils/Logger.pm @@ -66,18 +66,12 @@ sub set_config { } $loglevel = $config->bootstrap->loglevel; - if($loglevel = 1){ $loglevel = ERROR(); } - elsif($loglevel = 2){ $loglevel = WARN(); } - elsif($loglevel = 3){ $loglevel = INFO(); } - elsif($loglevel = 4){ $loglevel = DEBUG(); } - elsif($loglevel = 5){ $loglevel = INTERNAL(); } - else{$loglevel= INFO(); } $logfile = $config->bootstrap->logfile; if($logfile =~ /^syslog/) { $syslog_enabled = 1; $logfile_enabled = 0; - $logfile =~ s/^syslog:?//; + $logfile = $config->bootstrap->syslog; $facility = $logfile; $logfile = undef; $facility = _fac_to_const($facility); @@ -85,16 +79,28 @@ sub set_config { } else { $logfile = "$logfile"; } - $actfile = $config->bootstrap->actlog; - if($actfile =~ /^syslog/) { - $act_syslog_enabled = 1; - $act_logfile_enabled = 0; - $actfile =~ s/^syslog:?//; - $actfac = $actfile || "local1"; - $actfile = undef; - $actfac = _fac_to_const($actfac); - } else { $actfile = "$actfile"; } + if($syslog_enabled) { + # -------------------------------------------------------------- + # if we're syslogging, see if we have a special syslog facility + # for activity logging. If not, use the syslog facility for + # standard logging + # -------------------------------------------------------------- + $act_syslog_enabled = 1; + $act_logfile_enabled = 0; + $actfac = $config->bootstrap->actlog || $config->bootstrap->syslog; + $actfac = _fac_to_const($actfac); + $actfile = undef; + } else { + # -------------------------------------------------------------- + # we're not syslogging, use any specified activity log file. + # Fall back to the standard log file otherwise + # -------------------------------------------------------------- + $act_syslog_enabled = 0; + $act_logfile_enabled = 1; + $actfile = $config->bootstrap->actlog || $config->bootstrap->logfile; + } + $isclient = (OpenSRF::Utils::Config->current->bootstrap->client =~ /^true$/iog) ? 1 : 0; } -- 2.43.2