changeset 6145:b1fc5a98952c

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.
author Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
date Fri, 19 Aug 2016 22:02:24 +0200
parents e56d11a19d3c
children 07844f0bc410
files kallithea/tests/test.ini scripts/generate-ini.py
diffstat 2 files changed, 16 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- 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 ##
--- 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',
             },
         },
     ),