From 2974cac40cc7709909fcb11a510f164c88e7db46 Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Wed, 19 Jun 2013 22:10:18 -0400 Subject: [PATCH] RF: log all logging output from fail2ban-client to stderr. Close #264 otherwise it 1. 'interferes' with meaninful output of the client 2. if ERROR is logged it better go to stderr and separating ERROR from other levels is not that transparent with python's logging --- ChangeLog | 3 ++- fail2ban-client | 8 ++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index a6bc4e21..f2425d2f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -24,7 +24,8 @@ ver. 0.8.11 (2013/XX/XXX) - wanna-be-released sample logs Yaroslav Halchenko * fail2ban-regex -- refactored to provide more details (missing and - ignored lines, control over logging, etc) while maintaining look&feel. + ignored lines, control over logging, etc) while maintaining look&feel + * fail2ban-client -- log to standard error ver. 0.8.10 (2013/06/12) - wanna-be-secure ----------- diff --git a/fail2ban-client b/fail2ban-client index de8519f4..57235d79 100755 --- a/fail2ban-client +++ b/fail2ban-client @@ -336,13 +336,13 @@ class Fail2banClient: logSys.setLevel(logging.INFO) else: logSys.setLevel(logging.DEBUG) - # Add the default logging handler - stdout = logging.StreamHandler(sys.stdout) + # Add the default logging handler to dump to stderr + logout = logging.StreamHandler(sys.stderr) # set a format which is simpler for console use formatter = logging.Formatter('%(levelname)-6s %(message)s') # tell the handler to use this format - stdout.setFormatter(formatter) - logSys.addHandler(stdout) + logout.setFormatter(formatter) + logSys.addHandler(logout) # Set the configuration path self.__configurator.setBaseDir(self.__conf["conf"])