Hacker News new | past | comments | ask | show | jobs | submit login

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?

Yes, 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.

Examples 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
Using logging_tree will give you a good idea of the loggers that have been initialized on the libraries that you're using.

Good points. I'll probably switch to the modular way in the next project.

Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact