This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author andriusl
Recipients andriusl, peter.otten, vinay.sajip, xtreak
Date 2019-03-06.15:34:35
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1551886476.05.0.542250512613.issue36193@roundup.psfhosted.org>
In-reply-to
Content
Peter,
well I don't have deep experience with logging lib to know all ins and outs. So I might not be correct person to define what should be changed specifically. But I think it should be consistent on all standard libraries how it handles stdout/stderr, unless there is a reason to do it differently?

For example `print` to me seems to behave how I expect, because if stdout is redirected elsewhere, print uses redirected stdout without a problem. 

Now with logging, it does feel strange that on first call of `logging`, it sets internally stderr where it is pointing at that moment and forgets about it. You call logging again, and it naively expects stderr to be where it was on initial call, when in reality it might be redirected elsewhere (as in my case).

Maybe you know the reasoning why logging even needs to behave this way? Though if logging behaves this way, why print behaves differently?

So to summarize this, I think all libraries should respect stdout/stderr where it is and have some unified way/interface (like I expected redirect_stdout/redirect_stderr to be) to specify that stdout/stderr has changed and related libraries must update their state regarding that (logging library case) or simply rely on where stdout/stderr is pointed, so nothing needs to be done on that library once stdout/stderr is redirected.


To comment on your view about `dump_stuff(dest)`. Well I think this suits well, when you have something to dump already, but what if something to dump is what is produced via stdout/stderr and you need to capture it first? How can I do that without first redirecting stdout where I need to?
History
Date User Action Args
2019-03-06 15:34:36andriuslsetrecipients: + andriusl, vinay.sajip, peter.otten, xtreak
2019-03-06 15:34:36andriuslsetmessageid: <1551886476.05.0.542250512613.issue36193@roundup.psfhosted.org>
2019-03-06 15:34:36andriusllinkissue36193 messages
2019-03-06 15:34:35andriuslcreate