diff --git a/src/warden-client/lib/WardenClientCommon.pm b/src/warden-client/lib/WardenClientCommon.pm index d0e87bdf13ed090248e9dc87a1230c0aa10b4cda..69930023d889feadcfe7f0b7ed6c03e72915be1f 100755 --- a/src/warden-client/lib/WardenClientCommon.pm +++ b/src/warden-client/lib/WardenClientCommon.pm @@ -38,22 +38,30 @@ sub errMsg { my $msg = shift; my $type = shift; + defined $type or $type = "err"; # default type is err. Other: warn + my $err_msg = $msg; + my $syslog_msg = $msg; + + # check verbose logging to STDERR + if ($WardenClientCommon::LOG_STDERR_VERBOSE) { + $err_msg .= "\nStack info: " . Carp::longmess(); + } - # check verbose logging - if (($type eq "err") && ($WardenClientCommon::LOG_VERBOSE)) { - $msg .= "\nStack info: " . Carp::longmess(); + # check verbose logging to SYSLOG + if ($WardenClientCommon::SYSLOG_VERBOSE) { + $syslog_msg .= "\nStack info: " . Carp::longmess(); } - # check logging into STDERR + # check logging to STDERR if ($WardenClientCommon::LOG_STDERR) { - print STDERR $msg . "\n"; + print STDERR $err_msg . "\n"; } - # check logging into Syslog + # check logging to SYSLOG if ($WardenClientCommon::SYSLOG) { - openlog("Warden-client:", "pid", "$WardenClientCommon::SYSLOG_FACILITY"); - syslog("$type|$WardenClientCommon::SYSLOG_FACILITY", $msg . "\n"); + openlog("warden-client:", "pid", "$WardenClientCommon::SYSLOG_FACILITY"); + syslog("$type|$WardenClientCommon::SYSLOG_FACILITY", $syslog_msg . "\n"); closelog(); } @@ -130,7 +138,7 @@ sub c2s my $response; eval { $response = $soap->deserializer->deserialize($result); - } or return errMsg("Error in deserialization of server response: " . trim($@) . "\nReceived response: " . trim($result)); + } or return errMsg("Error in deserialization of server response: " . trim($@) . "\nReceived response: " . trim($result) . "\n\n(Maybe you don't have permission to SSL cert/key.)"); # check SOAP fault status $response->fault ? return errMsg("Server sent error message: " . trim($response->faultstring)) : return $response; } @@ -151,8 +159,9 @@ sub loadConf our $MAX_RCV_EVENTS_LIMIT = undef; our $CONNECTION_TIMEOUT = undef; our $LOG_STDERR = undef; - our $LOG_VERBOSE = undef; + our $LOG_STDERR_VERBOSE = undef; our $SYSLOG = undef; + our $SYSLOG_VERBOSE = undef; our $SYSLOG_FACILITY = undef; unless (do $conf_file) {