2 ms·
Well yes, but with basic_config I'm telling the root logger in a central fashion what it's supposed to do - at least that's how I understand it. So far I've nev
by m_mueller 11y ago
Well yes, but with basic_config I'm telling the root logger in a central fashion what it's supposed to do - at least that's how I understand it. So far I've never had the urge to initialize separate child loggers for every component. Do people do that mainly so you can have fine grained control over log levels?
- mixmastamyk 11y agoYes, otherwise you can get messages from noisy libraries bubbling up to the user that may not be relevant in the app context. If the logging is just going to a file to look at later it matters less, still sometimes it is nice to shut them up.
- m_mueller 11y agoGood points. I'll probably switch to the modular way in the next project.
- pyre 11y agoExamples of libraries that can be noisy: * Flask-CORS: When I first started using this it's default logging level was really noisy. * factory (aka Factory Boy): You can turn in DEBUG level to get a deluge of information about what is happening with your test data. * SQLAlchemy: The 'echo' option to create_engine isn't the only way that you can control logging. E.g.: import logging logging.basicConfig() logging.getLogger('sqlalchemy.engine').setLevel(logging.INFO) Using logging_tree will give you a good idea of the loggers that have been initialized on the libraries that you're using.