Created on 2021-08-05.20:40:14 by JonLevy, last changed 1 month ago by JonLevy.
In my experiment, yes
disable_existing_loggers=True causes the existing logger to receive the configuration. I.e., setting
level=WARN in the config file silences the
INFO messages coming from
 My test was with python 2.7, in a migration to Tryton 4.0, but I expect that this behavior is the same in python 3.x.
disable_existing_loggers=True is set, does existing logger receive the configuration? In your example if the configuration file disable
INFO level, is it disabled?
I should have been more clear. I am talking about the logger in
modules/__init__.py. What I experienced is that, when using a logging configuration file, I did not get the
INFO log statements from this logger. Upon debugging, I found that
logger.disabled == True, so it made no statements. I expect that you can easily reproduce this behavior by comparing the log statements you get from running a database update with a configuration file versus without. When passing a configuration file, you will see fewer log statements.
The reason this happens is that the default behavior of
logging.config.fileConfig is to disabled any loggers that already exist before that function is called. This can be corrected either by passing
disable_existing_loggers=True, or by changing the order so that the logger is created after the
fileConfig is applied.
I'm not sure to understand. Which
__init__.py file are you talking about? Nor why should it be ignored by the configuration set by
__init__.py provides useful logging statement during database update. However, these are suppressed when using a logging config file. This happens because the
logger instance in
__init__.py is created before the logging config file is applied in
commandline.py, and the default behavior of
logging.config.fileConfig is to disable existing loggers.
This can be corrected by passing
|2021-08-06 15:32:12||JonLevy||set||messages: + msg69227|
|2021-08-06 14:19:07||ced||set||messages: + msg69223|
|2021-08-06 14:06:26||JonLevy||set||messages: + msg69221|
nosy: + ced
|2021-08-05 23:37:17||ced||set||assignedto: JonLevy|
keyword: + review
status: unread -> testing
Showing 10 items. Show all history (warning: this could be VERY long)