Skip to content
Snippets Groups Projects
Commit bcb47abe authored by Jan Soukal's avatar Jan Soukal
Browse files

Pridana podpora atributu LOG_VERBOSE v konfiguraku, odebrany...

Pridana podpora atributu LOG_VERBOSE v konfiguraku, odebrany LOG_STDERR_VERBOSE a LOG_SYSLOG_VERBOSE, rozdelane logovani do Syslogu.
parent 9b530bac
No related branches found
No related tags found
No related merge requests found
...@@ -37,9 +37,14 @@ $MAX_RCV_EVENTS_LIMIT = 6000; #consumes app. 250 MB of memory ...@@ -37,9 +37,14 @@ $MAX_RCV_EVENTS_LIMIT = 6000; #consumes app. 250 MB of memory
# a stack (0) or print debug info # a stack (0) or print debug info
# including err. message and stack (1) # including err. message and stack (1)
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
$LOG_STDERR = 0; $LOG_STDERR = 1;
$LOG_STDERR_VERBOSE = 0;
$LOG_SYSLOG = 1; $LOG_SYSLOG = 1;
$LOG_SYSLOG_FACILITY = "local7"; $LOG_SYSLOG_FACILITY = "local7";
$LOG_SYSLOG_VERBOSE = 1;
\ No newline at end of file $LOG_VERBOSE = 0;
1;
\ No newline at end of file
...@@ -26,10 +26,9 @@ sub loadConf ...@@ -26,10 +26,9 @@ sub loadConf
our $SSL_CA_FILE = undef; our $SSL_CA_FILE = undef;
our $MAX_RCV_EVENTS_LIMIT = undef; our $MAX_RCV_EVENTS_LIMIT = undef;
our $LOG_STDERR = 0; our $LOG_STDERR = 0;
our $LOG_STDERR_VERBOSE = 0;
our $LOG_SYSLOG = 0; our $LOG_SYSLOG = 0;
our $LOG_SYSLOG_FACILITY = "local7"; our $LOG_SYSLOG_FACILITY = "local7";
our $LOG_SYSLOG_VERBOSE = 0; our $LOG_VERBOSE = 0;
# load set variables by user # load set variables by user
unless (do $conf_file) { unless (do $conf_file) {
...@@ -38,7 +37,7 @@ sub loadConf ...@@ -38,7 +37,7 @@ sub loadConf
# if $_ defined, it's retvalue of last statement of conf, for which we don't care # 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 } # End of loadConf
1; 1;
...@@ -14,21 +14,18 @@ use IO::Socket::SSL qw(debug1); ...@@ -14,21 +14,18 @@ use IO::Socket::SSL qw(debug1);
use SOAP::Transport::HTTP; use SOAP::Transport::HTTP;
use FindBin; use FindBin;
use Carp; use Carp;
use Sys::Syslog;
our $VERSION = "2.0"; our $VERSION = "2.0";
#----- global configuration variables ----------------------------------------- #----- global configuration variables -----------------------------------------
our $LOG_STDERR = 1; our $LOG_STDERR = 1;
our $LOG_STDERR_VERBOSE = 0;
our $LOG_SYSLOG = 0; our $LOG_SYSLOG = 0;
our $LOG_SYSLOG_FACILITY; 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; our $LOG_VERBOSE = 0;
#----- end of configuration variables ------------------------------------------
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
# errMsg - print error message and die # errMsg - print error message and die
...@@ -122,8 +119,7 @@ sub getNewEvents ...@@ -122,8 +119,7 @@ sub getNewEvents
require $libdir . "WardenClientConf.pm"; require $libdir . "WardenClientConf.pm";
my $conf_file = $etcdir . "warden-client.conf"; my $conf_file = $etcdir . "warden-client.conf";
my ($uri, $ssl_key_file, $ssl_cert_file, $ssl_ca_file, $max_rcv_events_limit); 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); ($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);
$LOG_VERBOSE = ($LOG_STDERR_VERBOSE or $LOG_SYSLOG_VERBOSE);
# test # test
# errMsg("testovaci error\n"); # errMsg("testovaci error\n");
...@@ -208,15 +204,16 @@ sub getNewEvents ...@@ -208,15 +204,16 @@ sub getNewEvents
or do { or do {
if ($LOG_STDERR) { if ($LOG_STDERR) {
# TODO: rozlisovat VERBOSE (STDERR vs. Syslog)?
print STDERR "(STDERR)Warden-client unexpected end in eval block.\n" . $@ . "\n"; print STDERR "(STDERR)Warden-client unexpected end in eval block.\n" . $@ . "\n";
} }
if ($LOG_SYSLOG) { if ($LOG_SYSLOG) {
# TODO: rozlisovat VERBOSE (STDERR vs. Syslog)?
#TODO: zapis do syslogu, ne STDERR #TODO: zapis do syslogu, ne STDERR
print STDERR "(SYSLOG)Warden-client unexpected end in eval block.\n" . $@ . "\n"; 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; return;
}; };
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment