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

Thomas Passin list1 at tompassin.net
Thu Jan 5 16:09:00 EST 2023


On 1/5/2023 3:29 PM, Grant Edwards wrote:
> On 2023-01-05, Thomas Passin <list1 at tompassin.net> wrote:
> 
>> The logging system is so configurable that...
> 
> I find it almost impossible to use unless I copy a working example I
> find somewhere. ;)
> 
> I'm not at all surprised that the OP didn't understand how it
> works. I've been writing Python programs for over 20 years, and it's
> beyond me.

I know what you mean!  I have never used the Python logging package, but 
I inherited a java project that uses Log4j.  Talk about obscure!  The 
python docs are a wonder of clarity beside Log4j.  So most of my Log4j 
configuration has been by copy-pasta, with occasional surprises and 
Log4j bug bites.  Like a handler that deleted its own previous log file 
when it rolled over at midnight - a "feature" that wasn't advertised.

I will say, though, that having used a bit of Log4j must have been 
helpful, since much of what is in the Python logging package docs seemed 
somewhat familiar and even seemed to make sense.

BTW, I was able to re-create that java project using Jython for about 
90% of it.  Way better!



More information about the Python-list mailing list