I have a root logger object that I am passing to another module through init calls.
Root_Script.py
import logging
import module
global logger
*initialize logger*
#call module.py and pass the logger to it
module.LOG_TEST(logger)
Module.py
import logging
class LOG_TEST(logger):
self.logger=logger
## want to set up a log level for this particular logger ##
So I have a group of such modules for which I want to set up a different logger configuration. Like i want to set LogLevel to ERROR for these modules.
Now i want to use a config file which i can call in each of these modules and it should change the log levels. So I went through the Logging Documentation and followed it religously.
I used
self.logger=logger.getLogger()
self.logger.setLevel(logging.ERROR)
to achieve this but it doesn't work. Can anyone point out to me how can I set up this with a config file and what I am doing wrong here ?
P.S. I don't want to change the fact that I pass a logger object directly to each of these modules. Please help me without any changes to this.
Thanks!!