diff --git a/src/warden-client/etc/warden-client.conf b/src/warden-client/etc/warden-client.conf
index 1f38514dc67da5ead9103a3196e4447e8d605ecd..0c9e8f994e0e35cb6c8d48324a70b96b87f43efb 100644
--- a/src/warden-client/etc/warden-client.conf
+++ b/src/warden-client/etc/warden-client.conf
@@ -28,3 +28,18 @@ $SSL_CA_FILE = "/etc/ssl/certs/tcs-ca-bundle.pem";
 #-------------------------------------------------------------------------------
 $MAX_RCV_EVENTS_LIMIT = 6000; #consumes app. 250 MB of memory
 
+#-------------------------------------------------------------------------------
+# Log options
+#
+# LOG_STDERR, LOG_SYSLOG - hide (0) or allow (1) error reporting on STDERR
+#                          and/or to Syslog
+# LOG_STDERR_VERBOSE, LOG_SYSLOG_VERBOSE - print only error message without
+#                                          a stack (0) or print debug info
+#                                          including err. message and stack (1)
+#-------------------------------------------------------------------------------
+$LOG_STDERR = 0;                        
+$LOG_STDERR_VERBOSE = 0;                              
+
+$LOG_SYSLOG = 1;   
+$LOG_SYSLOG_FACILITY = "local7"; 
+$LOG_SYSLOG_VERBOSE = 1;        
\ No newline at end of file
diff --git a/src/warden-client/lib/WardenClientConf.pm b/src/warden-client/lib/WardenClientConf.pm
index 7720f6bb2f14bdd1e990e7144e033a33dd90d4cc..da892ebf6d3f3ceb1bbe8c8dfd70e78c30d967ab 100755
--- a/src/warden-client/lib/WardenClientConf.pm
+++ b/src/warden-client/lib/WardenClientConf.pm
@@ -25,6 +25,11 @@ sub loadConf
   our $SSL_CERT_FILE = undef;
   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;
 
   # load set variables by user
   unless (do $conf_file) {
@@ -33,7 +38,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);
+  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);
 
 } # End of loadConf
 1;
diff --git a/src/warden-client/lib/WardenClientReceive.pm b/src/warden-client/lib/WardenClientReceive.pm
index d866cffc12dba6de66d2511afb8a29ba68c296b1..748a59168e2fa845673412c10b9eecc028dd7340 100755
--- a/src/warden-client/lib/WardenClientReceive.pm
+++ b/src/warden-client/lib/WardenClientReceive.pm
@@ -13,15 +13,34 @@ use SOAP::Lite;
 use IO::Socket::SSL qw(debug1);
 use SOAP::Transport::HTTP;
 use FindBin;
+use Carp;
 
 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;
+
 #-------------------------------------------------------------------------------
 # errMsg - print error message and die
 #-------------------------------------------------------------------------------
 sub errMsg
 {
-  my $msg = shift;
+  my $msg = "Error message: " . shift;
+
+  if ($LOG_VERBOSE) { # user wants to log debug information
+    $msg .= "\nStack info: " . Carp::longmess();
+  }
+
   die($msg . "\n");
 } # End of errMsg
 
@@ -70,6 +89,10 @@ sub c2s
   } else {
     # deserialized response from server -> create SOAP envelope and data object
     my $response;
+    
+    # test
+    errMsg("test error in c2s()");
+
     eval {
       $response = $soap->deserializer->deserialize($result);
     } or errMsg($@ . "Received data: " . $result);
@@ -98,7 +121,12 @@ sub getNewEvents
     # read the config file
     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) = WardenClientConf::loadConf($conf_file);
+    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);
+
+    # test
+    # errMsg("testovaci error\n");
 
     # set name of ID file for each client aplication 
     my $caller_name = $FindBin::Script;
@@ -178,7 +206,18 @@ sub getNewEvents
     }
   } # End of eval block
   or do {
-    print STDERR "Warden-client unexpected end in eval block: " . $@ . "\n";
+   
+    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";
+    }
     return;
   };