[REV] core: logger configuration part of 6044782aef

Configuring the non-root logger based on --log-level had the
side-effect (unclear whether it was intended or not as none of the
relevant commits really documented the idea) that log-level could
override log handlers being set on the root logger e.g. if
`log_handler = :INFO` is set in the config file, `--log-level=warn` on
the CLI will override it.

This could be replicated by swapping `pseudo_config` and `logconfig`,
*however* it would also make the sub-loggers override
differently (currently on an exact logger match log-handler overrides
log-level).

The ideal fix would likely be to sequence log-level from the
configuration file, log-handler from the configuration file, log-level
from the CLI and log-handler from the CLI. However that doesn't really
work with the current structure.

closes odoo/odoo#41180

Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
This commit is contained in:
Xavier Morel
2019-12-02 12:38:49 +00:00
parent f662855701
commit 56e47c51ed
+6 -6
View File
@@ -215,12 +215,12 @@ DEFAULT_LOG_CONFIGURATION = [
':INFO',
]
PSEUDOCONFIG_MAPPER = {
'debug_rpc_answer': [':DEBUG', 'odoo.sql_db:INFO', 'odoo.http.rpc:DEBUG'],
'debug_rpc': [':DEBUG', 'odoo.sql_db:INFO', 'odoo.http.rpc.request:DEBUG'],
'debug': [':DEBUG', 'odoo.sql_db:INFO'],
'debug_rpc_answer': ['odoo:DEBUG', 'odoo.sql_db:INFO', 'odoo.http.rpc:DEBUG'],
'debug_rpc': ['odoo:DEBUG', 'odoo.sql_db:INFO', 'odoo.http.rpc.request:DEBUG'],
'debug': ['odoo:DEBUG', 'odoo.sql_db:INFO'],
'debug_sql': ['odoo.sql_db:DEBUG'],
'info': [],
'warn': [':WARNING'],
'error': [':ERROR'],
'critical': [':CRITICAL'],
'warn': ['odoo:WARNING', 'werkzeug:WARNING'],
'error': ['odoo:ERROR', 'werkzeug:ERROR'],
'critical': ['odoo:CRITICAL', 'werkzeug:CRITICAL'],
}