mirror of https://github.com/fail2ban/fail2ban
ENH: 'heavydebug' level == 5 for even more debugging in tricky cases
I mocked logging library directly -- seems to be Ok.pull/256/head
parent
9b351350dd
commit
97f9cfc0b0
|
@ -23,3 +23,8 @@
|
||||||
__author__ = "Cyril Jaquier"
|
__author__ = "Cyril Jaquier"
|
||||||
__copyright__ = "Copyright (c) 2004 Cyril Jaquier"
|
__copyright__ = "Copyright (c) 2004 Cyril Jaquier"
|
||||||
__license__ = "GPL"
|
__license__ = "GPL"
|
||||||
|
|
||||||
|
import logging
|
||||||
|
|
||||||
|
# Custom debug level
|
||||||
|
logging.HEAVYDEBUG = 5
|
||||||
|
|
|
@ -52,7 +52,7 @@ def get_opt_parser():
|
||||||
p.add_options([
|
p.add_options([
|
||||||
Option('-l', "--log-level", type="choice",
|
Option('-l', "--log-level", type="choice",
|
||||||
dest="log_level",
|
dest="log_level",
|
||||||
choices=('debug', 'info', 'warn', 'error', 'fatal'),
|
choices=('heavydebug', 'debug', 'info', 'warning', 'error', 'fatal'),
|
||||||
default=None,
|
default=None,
|
||||||
help="Log level for the logger to use during running tests"),
|
help="Log level for the logger to use during running tests"),
|
||||||
Option('-n', "--no-network", action="store_true",
|
Option('-n', "--no-network", action="store_true",
|
||||||
|
@ -76,7 +76,8 @@ parser = get_opt_parser()
|
||||||
logSys = logging.getLogger("fail2ban")
|
logSys = logging.getLogger("fail2ban")
|
||||||
|
|
||||||
# Numerical level of verbosity corresponding to a log "level"
|
# Numerical level of verbosity corresponding to a log "level"
|
||||||
verbosity = {'debug': 3,
|
verbosity = {'heavydebug': 4,
|
||||||
|
'debug': 3,
|
||||||
'info': 2,
|
'info': 2,
|
||||||
'warn': 1,
|
'warn': 1,
|
||||||
'error': 1,
|
'error': 1,
|
||||||
|
|
|
@ -291,6 +291,8 @@ class Filter(JailThread):
|
||||||
except UnicodeDecodeError:
|
except UnicodeDecodeError:
|
||||||
l = line
|
l = line
|
||||||
l = l.rstrip('\r\n')
|
l = l.rstrip('\r\n')
|
||||||
|
|
||||||
|
logSys.log(5, "Working on line %r", l)
|
||||||
timeMatch = self.dateDetector.matchTime(l)
|
timeMatch = self.dateDetector.matchTime(l)
|
||||||
if timeMatch:
|
if timeMatch:
|
||||||
# Lets split into time part and log part of the line
|
# Lets split into time part and log part of the line
|
||||||
|
@ -355,6 +357,8 @@ class Filter(JailThread):
|
||||||
if failRegex.hasMatched():
|
if failRegex.hasMatched():
|
||||||
# The failregex matched.
|
# The failregex matched.
|
||||||
date = self.dateDetector.getUnixTime(timeLine)
|
date = self.dateDetector.getUnixTime(timeLine)
|
||||||
|
logSys.log(7, "Date: %r, message: %r",
|
||||||
|
timeLine, logLine)
|
||||||
if date is None:
|
if date is None:
|
||||||
logSys.debug("Found a match for %r but no valid date/time "
|
logSys.debug("Found a match for %r but no valid date/time "
|
||||||
"found for %r. Please file a detailed issue on"
|
"found for %r. Please file a detailed issue on"
|
||||||
|
|
Loading…
Reference in New Issue