Reputation: 2015
This is just a quick and simple question to clarify my study of the logging module. It looks like nothing gets logged anywhere without a log request [i.e., logging.info('Hi there')]. So if something shows up in my logs, and I did not make that request, it is buried somewhere in library code. Or, to put it another way, there is no such thing as 'automatic' logging. Somehow, somewhere, a log request has to be made by a human. Correct? Thanks.
Upvotes: 1
Views: 1115
Reputation: 11
It depends what are you going to create.
For example, if you are going to develop a Flask app where you want to log activities corresponding with databases, you can implement it in one place and 'listen' to all events.
I haven't done it yet (and was asking myself the same question), but I found this tutorial.
Upvotes: 1
Reputation: 40878
So if something shows up in my logs, and I did not make that request, it is buried somewhere in library code. Or, to put it another way, there is no such thing as 'automatic' logging. Somehow, somewhere, a log request has to be made by a human. Correct?
Correct.
Somewhere a Python package that you've imported (note: might be a nested dependency rather than direct import) has not followed the practice of using NullHandler
and instead decided to configure its own logger to emit something to stdout without you asking it to.
Upvotes: 1