Python registration issue

I have a question about the standard python logging mechanism. Therefore, if I use logging.config.fileConfig to load my configuration file, I create loggers for some modules using logging.getLogger, checking them right after creation, and they work. Now, if I call logging.config.fileConfig again with the same configuration file and create loggers for some other module, will the previous ones still work? Mostly for the following logic:

logging.config.fileConfig(config_file)
logger1 = logging.getLogger(module1)
logger2 = logging.getLogger(module2)
logging.config.fileConfig(config_file)
logger3 = logging.getLogger(module3)

config_file is the same for both calls. Should logger1 and logger2 function? How about if config_file is different in these calls? Currently my logger1 and logger2 do not work after loading a new config_file. So, the first step is to check the normal behavior. If it is possible to make this work without combining the two configuration files into one large?

Regards, Bogdan

+3
source share
1 answer

, : , , , fileConfig(), . , Python. fileConfig() , . , .

, , ; ?

+2

All Articles