git.net

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

How come logging.error writes to a file, but not logging.debug or logging.info?


On 27Mar2020 16:18, Dan Campbell <dcwhatthe at gmail.com> wrote:
>Got it.  I had to set the minimum level, in the basic config, thus:
>
>    logging.basicConfig( filename = "whatthe.log", level=logging.INFO )

Good, you've found the table of predefined logging levels in the module 
docs then?

You'll notice that they are spaced apart by 10; in principle one can 
choose levels between them. Kind of irrelevant if nothing logs at such 
an intermediate level, but...

For example, I define for myself a TRACE value between INFO and WARNING, 
and a trace() call which logs at that level (like the predefined 
warning() function logs at logging.WARNING level). I often find my info 
calls are too verbose, and the warnings are only for badness, so I have 
a kind of intermediate call for "high level" far less frequent logs.

Cheers,
Cameron Simpson <cs at cskk.id.au>