From bcb47abe0b9b0b9db653db91e29ceb75b6ff6afb Mon Sep 17 00:00:00 2001 From: Jan Soukal <soukal@ics.muni.cz> Date: Fri, 31 Aug 2012 17:19:13 +0200 Subject: [PATCH] Pridana podpora atributu LOG_VERBOSE v konfiguraku, odebrany LOG_STDERR_VERBOSE a LOG_SYSLOG_VERBOSE, rozdelane logovani do Syslogu. --- src/warden-client/etc/warden-client.conf | 11 ++++++++--- src/warden-client/lib/WardenClientConf.pm | 5 ++--- src/warden-client/lib/WardenClientReceive.pm | 19 ++++++++----------- 3 files changed, 18 insertions(+), 17 deletions(-) diff --git a/src/warden-client/etc/warden-client.conf b/src/warden-client/etc/warden-client.conf index 0c9e8f9..a58d30b 100644 --- a/src/warden-client/etc/warden-client.conf +++ b/src/warden-client/etc/warden-client.conf @@ -37,9 +37,14 @@ $MAX_RCV_EVENTS_LIMIT = 6000; #consumes app. 250 MB of memory # a stack (0) or print debug info # including err. message and stack (1) #------------------------------------------------------------------------------- -$LOG_STDERR = 0; -$LOG_STDERR_VERBOSE = 0; +$LOG_STDERR = 1; $LOG_SYSLOG = 1; $LOG_SYSLOG_FACILITY = "local7"; -$LOG_SYSLOG_VERBOSE = 1; \ No newline at end of file + +$LOG_VERBOSE = 0; + + + +1; + \ No newline at end of file diff --git a/src/warden-client/lib/WardenClientConf.pm b/src/warden-client/lib/WardenClientConf.pm index da892eb..2acd29f 100755 --- a/src/warden-client/lib/WardenClientConf.pm +++ b/src/warden-client/lib/WardenClientConf.pm @@ -26,10 +26,9 @@ sub loadConf our $SSL_CA_FILE = undef; our $MAX_RCV_EVENTS_LIMIT = undef; our $LOG_STDERR = 0; - our $LOG_STDERR_VERBOSE = 0; our $LOG_SYSLOG = 0; our $LOG_SYSLOG_FACILITY = "local7"; - our $LOG_SYSLOG_VERBOSE = 0; + our $LOG_VERBOSE = 0; # load set variables by user unless (do $conf_file) { @@ -38,7 +37,7 @@ sub loadConf # if $_ defined, it's retvalue of last statement of conf, for which we don't care } - return ($URI, $SSL_KEY_FILE, $SSL_CERT_FILE, $SSL_CA_FILE, $MAX_RCV_EVENTS_LIMIT, $LOG_STDERR, $LOG_STDERR_VERBOSE, $LOG_SYSLOG, $LOG_SYSLOG_FACILITY, $LOG_SYSLOG_VERBOSE); + return ($URI, $SSL_KEY_FILE, $SSL_CERT_FILE, $SSL_CA_FILE, $MAX_RCV_EVENTS_LIMIT, $LOG_STDERR, $LOG_SYSLOG, $LOG_SYSLOG_FACILITY, $LOG_VERBOSE); } # End of loadConf 1; diff --git a/src/warden-client/lib/WardenClientReceive.pm b/src/warden-client/lib/WardenClientReceive.pm index 748a591..059011b 100755 --- a/src/warden-client/lib/WardenClientReceive.pm +++ b/src/warden-client/lib/WardenClientReceive.pm @@ -14,21 +14,18 @@ use IO::Socket::SSL qw(debug1); use SOAP::Transport::HTTP; use FindBin; use Carp; +use Sys::Syslog; our $VERSION = "2.0"; #----- global configuration variables ----------------------------------------- our $LOG_STDERR = 1; -our $LOG_STDERR_VERBOSE = 0; + our $LOG_SYSLOG = 0; our $LOG_SYSLOG_FACILITY; -our $LOG_SYSLOG_VERBOSE = 0; -#------ end of configuration variables ----------------------------------------- -# Retrieve stack info when handling errors? 0 is default, the precise value is -# computed as (LOG_STDERR_VERBOSE or LOG_SYSLOG_VERBOSE) after config file is -# read. our $LOG_VERBOSE = 0; +#----- end of configuration variables ------------------------------------------ #------------------------------------------------------------------------------- # errMsg - print error message and die @@ -122,8 +119,7 @@ sub getNewEvents require $libdir . "WardenClientConf.pm"; my $conf_file = $etcdir . "warden-client.conf"; my ($uri, $ssl_key_file, $ssl_cert_file, $ssl_ca_file, $max_rcv_events_limit); - ($uri, $ssl_key_file, $ssl_cert_file, $ssl_ca_file, $max_rcv_events_limit, $LOG_STDERR, $LOG_STDERR_VERBOSE, $LOG_SYSLOG, $LOG_SYSLOG_FACILITY, $LOG_SYSLOG_VERBOSE) = WardenClientConf::loadConf($conf_file); - $LOG_VERBOSE = ($LOG_STDERR_VERBOSE or $LOG_SYSLOG_VERBOSE); + ($uri, $ssl_key_file, $ssl_cert_file, $ssl_ca_file, $max_rcv_events_limit, $LOG_STDERR, $LOG_SYSLOG, $LOG_SYSLOG_FACILITY, $LOG_VERBOSE) = WardenClientConf::loadConf($conf_file); # test # errMsg("testovaci error\n"); @@ -208,15 +204,16 @@ sub getNewEvents or do { if ($LOG_STDERR) { - # TODO: rozlisovat VERBOSE (STDERR vs. Syslog)? print STDERR "(STDERR)Warden-client unexpected end in eval block.\n" . $@ . "\n"; } if ($LOG_SYSLOG) { - # TODO: rozlisovat VERBOSE (STDERR vs. Syslog)? - #TODO: zapis do syslogu, ne STDERR print STDERR "(SYSLOG)Warden-client unexpected end in eval block.\n" . $@ . "\n"; + + # openlog("Warden:", "pid", "$LOG_SYSLOG_FACILITY"); + # syslog("err|$LOG_SYSLOG_FACILITY", "Warden-client unexpected end in eval block.\n" . $@ . "\n"); + # closelog(); } return; }; -- GitLab