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

Dan Campbell dcwhatthe at gmail.com
Sat Mar 28 10:17:26 EDT 2020


I probably won't need to do that, in this case. But good advice, in other
contexts ; I'll put it in the pim, for further reference, thanks.
On Fri, Mar 27, 2020 at 7:09 PM Cameron Simpson <cameron.simpson at gmail.com>
wrote:
> 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>
>


More information about the Python-list mailing list

AltStyle によって変換されたページ (->オリジナル) /