classification
Title: Add argument to control file object used by BaseHTTPServer’s log_message
Type: behavior Stage: test needed
Components: Library (Lib) Versions: Python 3.3
process
Status: closed Resolution: rejected
Dependencies: Superseder:
Assigned To: Nosy List: BreamoreBoy, dstanek, eric.araujo, georg.brandl, pitrou, tomkm
Priority: normal Keywords: easy, patch

Created on 2009-07-30 11:13 by tomkm, last changed 2013-10-13 18:33 by georg.brandl. This issue is now closed.

Files
File name Uploaded Description Edit
6602.patch dstanek, 2010-08-04 01:17
Messages (6)
msg91093 - (view) Author: (tomkm) Date: 2009-07-30 11:13
I believe that the log_message method of BaseHTTPServer should log to
sys.stdout not sys.stderr, whereas log_error should log to sys.stderr
instead of just delegating to log_message.

I found this inconsistency when using SimpleXMLRPCServer which logs both
successful (200) and non-successful (non-200) requests to stderr when
logRequests is set to True.
msg112305 - (view) Author: Mark Lawrence (BreamoreBoy) * Date: 2010-08-01 10:13
The OP's comments strike me as sensible, do others agree or disagree?
msg112733 - (view) Author: David Stanek (dstanek) Date: 2010-08-04 01:17
I think this is the right thing to do. To help this along I've included a patch. The codereview is also available: http://codereview.appspot.com/1697062.
msg160137 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2012-05-07 11:09
Disagreed. sys.stderr is not only for "errors" but all informational messages of little value (warnings, debug messages etc.). Also, logging to two different streams makes redirecting clumsier.

If you want to change this, it would more useful to add a facility to allow users to choose output streams. Or even - shocking idea - to integrate the logging module in BaseHTTPServer.
msg160183 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2012-05-08 03:33
Clearly +1 to Antoine; that’s just how unix programs do it.  stdout is for the program output, which may be formatted in a certain way in order to be piped to another program, and stderr is for all messages for the human user.  Editing the bug title and version to reflect Antoine’s suggestion, which does have a chance of going in if someone is interested in providing a patch.
msg199757 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2013-10-13 18:33
Agreed.
History
Date User Action Args
2013-10-13 18:33:55georg.brandlsetstatus: pending -> closed

nosy: + georg.brandl
messages: + msg199757

resolution: rejected
2012-05-08 03:33:24eric.araujosetstatus: open -> pending
title: BaseHTTPServer log_message should log to sys.stdout -> Add argument to control file object used by BaseHTTPServer’s log_message
nosy: + eric.araujo

messages: + msg160183

versions: - Python 2.7, Python 3.2
2012-05-07 11:09:46pitrousetnosy: + pitrou
messages: + msg160137
2012-05-06 22:31:14ezio.melottisetkeywords: + easy
versions: + Python 3.3, - Python 3.1
2010-08-04 01:17:08dstaneksetfiles: + 6602.patch

nosy: + dstanek
messages: + msg112733

keywords: + patch
2010-08-01 10:13:52BreamoreBoysettype: behavior
components: + Library (Lib), - None
versions: + Python 3.1, Python 2.7, Python 3.2, - Python 2.5
nosy: + BreamoreBoy

messages: + msg112305
stage: test needed
2009-07-30 11:13:23tomkmcreate