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 pekka.klarck
Recipients hpk, pekka.klarck, srid, vinay.sajip
Date 2012-03-08.21:07:59
SpamBayes Score 1.5559776e-13
Marked as misclassified No
Message-id <>
@vinay.sajip the problem is that many tools that don't do anything with logging module intercept sys.stdout and sys.stderr. Such tools typically aren't even aware of libraries they use (or test) using logging and much less about them registering StreamHandler using sys.stderr.

It's great that nowadays you don't always get ValueError at exit anymore. Now you only get them if the StreamHandler itself tries to use the stream after sys.stderr is restored and the intercepting stream closed. Typically this only happens in error situations so the problem isn't so severe.

IMHO nobody should ever register StreamHandler with sys.stderr because you cannot be sure has someone intercepted it or not. There's a strong convention that sys.__stderr__ should not be intercepted so using it is safe.

I strongly believe StreamHandler should be changed to use sys.__stderr__ by default. That shouldn't cause problems because a) if sys.stderr isn't intercepted sys.stderr is sys.__stderr__, and b) if sys.stderr is intercepted you most likely already have problems. I know stuff like this cannot be changed other than in major releases and there should perhaps even be a deprecation period. I also acknowledge that it might be too much work to be worth the effort. Mentioning this issue in the docs might be a good idea nevertheless.
Date User Action Args
2012-03-08 21:08:00pekka.klarcksetrecipients: + pekka.klarck, vinay.sajip, srid, hpk
2012-03-08 21:08:00pekka.klarcksetmessageid: <>
2012-03-08 21:07:59pekka.klarcklinkissue6333 messages
2012-03-08 21:07:59pekka.klarckcreate