diff --git a/doc/changelog.txt b/doc/changelog.txt index 0d2048c6..7d5ec649 100644 --- a/doc/changelog.txt +++ b/doc/changelog.txt @@ -10,6 +10,7 @@ Changes: Reason was the difficulty to run msgfmt.py under both Python 2 and 3. - checking: When checking SSL certificates under POSIX systems try to use the system certificate store. +- logging: improved debugging by also enabling urllib3 output Fixes: - checking: Correct typos in the proxy handling code. diff --git a/linkcheck/logconf.py b/linkcheck/logconf.py index 2f8f1069..1bad1ce5 100644 --- a/linkcheck/logconf.py +++ b/linkcheck/logconf.py @@ -47,16 +47,13 @@ configdict = { 'loggers': { }, 'root': { - 'level': 'DEBUG', + 'level': 'WARN', }, + 'incremental': True, } def init_log_config(handler=None): - """ - Set up the application logging (not to be confused with check - loggers). When debug is not None it is expected to be a list of - logger names for which debugging will be enabled. - + """Set up the application logging (not to be confused with check loggers). """ for applog in lognames.values(): # propagate except for root app logger 'linkcheck' @@ -70,15 +67,17 @@ def init_log_config(handler=None): def add_loghandler (handler): - """Add log handler to root logger LOG_ROOT and set formatting.""" - logging.getLogger(LOG_ROOT).addHandler(handler) - format = "%(levelname)s %(asctime)s %(threadName)s %(message)s" + """Add log handler to root logger and LOG_ROOT and set formatting.""" + format = "%(levelname)s %(name)s %(asctime)s %(threadName)s %(message)s" handler.setFormatter(logging.Formatter(format)) + logging.getLogger(LOG_ROOT).addHandler(handler) + logging.getLogger().addHandler(handler) def remove_loghandler (handler): - """Remove log handler from root logger LOG_ROOT.""" + """Remove log handler from root logger and LOG_ROOT.""" logging.getLogger(LOG_ROOT).removeHandler(handler) + logging.getLogger().removeHandler(handler) def reset_loglevel(): @@ -89,6 +88,9 @@ def reset_loglevel(): def set_debug(loggers): """Set debugging log level.""" set_loglevel(loggers, logging.DEBUG) + # enable for httplib debugging (used by requests.packages.urllib3) + #import httplib + #httplib.HTTPConnection.debuglevel = 1 def set_loglevel(loggers, level):