What should go to stdout/stderr and why Python logging write everything to stderr?

Grant Edwards grant.b.edwards at gmail.com
Thu Jan 5 16:59:23 EST 2023


On 2023-01-05, Weatherby,Gerard <gweatherby at uchc.edu> wrote:
> logging.basicConfig()
> logging.info(“Nice to know”)
> logging.debug(“Details for when things are funky”)
> logging.warn(“Trouble is brewing”)

I always seem to need something slightly more complex. Usually something like:

 * Specify a log level on the command line.
 * Allow logging to a file as specified on the command line.
 * Optional timestamps for log messages.

I know, without doubt, that it can easily do all those things. I just
never seem to be able to figure out how unless I can find example code
to look at.

--
Grant



More information about the Python-list mailing list