From 7e911137e8c6c9518ef5422a5c9d1d33229b897e Mon Sep 17 00:00:00 2001 From: Xavier Morel <xmo@odoo.com> Date: Wed, 18 Dec 2019 12:40:52 +0000 Subject: [PATCH] [IMP] core: strip log_handler items before splitting them Allows better formatted and commented log_handler items in configuration files: configparser allows multiline values and interspersed comments (stripping out comment lines), but while it removes indent it leaves the linebreaks, so e.g. foo = bar, # qux quux when parsed and split on "," results in `['\nbar', '\nquux']` which is obviously an issue for logging (as it assumes the leading `\n` is part of the logger name proper). Since log_handler items can be fairly long and are not necessarily self-descriptive as to *why* they were selected for re-configuration, allowing one per line & comments is helpful. --- odoo/netsvc.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/odoo/netsvc.py b/odoo/netsvc.py index 2cf24a36a616..ee4c60348b44 100644 --- a/odoo/netsvc.py +++ b/odoo/netsvc.py @@ -200,7 +200,7 @@ def init_logger(): logging_configurations = DEFAULT_LOG_CONFIGURATION + pseudo_config + logconfig for logconfig_item in logging_configurations: - loggername, level = logconfig_item.split(':') + loggername, level = logconfig_item.strip().split(':') level = getattr(logging, level, logging.INFO) logger = logging.getLogger(loggername) logger.setLevel(level) -- GitLab