# HG changeset patch # User Thomas De Schampheleire # Date 1471636944 -7200 # Node ID b1fc5a98952c830350ed7c3e65a1e1dcdd640704 # Parent e56d11a19d3c3924cbdea2d6bf41cb7a042d5746 test.ini: align some logging-related settings with development.ini When manually using test.ini (that is, not via the test suite) the coloring of log output like development.ini provides can be very useful. Note that this color output is not taken along by pytest-capturelog, regardless of this patch. Some extra-verbose logging in test.ini is on the other hand not needed and could be enabled when needed by a specific developer. Note: the 'level=DEBUG' setting for handler_console_sql is not taken along to test.ini: it causes duplicate sqlalchemy debug logs, one through handler_console_sql and another through another path. If future experience points out that some of these changes are actually worse than they were, adjustments can still be made. diff -r e56d11a19d3c -r b1fc5a98952c kallithea/tests/test.ini --- a/kallithea/tests/test.ini Fri Aug 19 22:38:19 2016 +0200 +++ b/kallithea/tests/test.ini Fri Aug 19 22:02:24 2016 +0200 @@ -531,8 +531,7 @@ ############# [logger_root] -#level = NOTSET -level = DEBUG +level = NOTSET handlers = console [logger_routes] @@ -561,10 +560,8 @@ propagate = 1 [logger_sqlalchemy] -#level = INFO -level = ERROR -#handlers = console_sql -handlers = console +level = INFO +handlers = console_sql qualname = sqlalchemy.engine propagate = 0 @@ -582,14 +579,16 @@ class = StreamHandler args = (sys.stderr,) #level = INFO -level = NOTSET -formatter = generic +level = DEBUG +#formatter = generic +formatter = color_formatter [handler_console_sql] class = StreamHandler args = (sys.stderr,) level = WARN -formatter = generic +#formatter = generic +formatter = color_formatter_sql ################ ## FORMATTERS ## diff -r e56d11a19d3c -r b1fc5a98952c scripts/generate-ini.py --- a/scripts/generate-ini.py Fri Aug 19 22:38:19 2016 +0200 +++ b/scripts/generate-ini.py Fri Aug 19 22:02:24 2016 +0200 @@ -62,15 +62,16 @@ 'beaker.cache.lock_dir': '%(here)s/../../data/test/cache/lock', 'sqlalchemy.db1.url': 'sqlite:///%(here)s/kallithea_test.sqlite', }, - '[logger_root]': { + '[handler_console]': { 'level': 'DEBUG', + 'formatter': 'color_formatter', }, - '[logger_sqlalchemy]': { - 'level': 'ERROR', - 'handlers': 'console', - }, - '[handler_console]': { - 'level': 'NOTSET', + # The 'handler_console_sql' block is very similar to the one in + # development.ini, but without the explicit 'level=DEBUG' setting: + # it causes duplicate sqlalchemy debug logs, one through + # handler_console_sql and another through another path. + '[handler_console_sql]': { + 'formatter': 'color_formatter_sql', }, }, ),