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
pull/265/head
Yaroslav Halchenko 2013-06-19 22:10:18 -04:00
parent 1ab0f0f9e3
commit 2974cac40c
2 changed files with 6 additions and 5 deletions

View File

@ -24,7 +24,8 @@ ver. 0.8.11 (2013/XX/XXX) - wanna-be-released
sample logs sample logs
Yaroslav Halchenko Yaroslav Halchenko
* fail2ban-regex -- refactored to provide more details (missing and * 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 ver. 0.8.10 (2013/06/12) - wanna-be-secure
----------- -----------

View File

@ -336,13 +336,13 @@ class Fail2banClient:
logSys.setLevel(logging.INFO) logSys.setLevel(logging.INFO)
else: else:
logSys.setLevel(logging.DEBUG) logSys.setLevel(logging.DEBUG)
# Add the default logging handler # Add the default logging handler to dump to stderr
stdout = logging.StreamHandler(sys.stdout) logout = logging.StreamHandler(sys.stderr)
# set a format which is simpler for console use # set a format which is simpler for console use
formatter = logging.Formatter('%(levelname)-6s %(message)s') formatter = logging.Formatter('%(levelname)-6s %(message)s')
# tell the handler to use this format # tell the handler to use this format
stdout.setFormatter(formatter) logout.setFormatter(formatter)
logSys.addHandler(stdout) logSys.addHandler(logout)
# Set the configuration path # Set the configuration path
self.__configurator.setBaseDir(self.__conf["conf"]) self.__configurator.setBaseDir(self.__conf["conf"])