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.

Title: Logging: StreamHandler does not use OS line separator.
Type: behavior Stage:
Components: Library (Lib) Versions: Python 2.7
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: Thorsten.W, alibotean, r.david.murray, vinay.sajip
Priority: normal Keywords:

Created on 2014-01-06 09:02 by alibotean, last changed 2022-04-11 14:57 by admin. This issue is now closed.

File name Uploaded Description Edit alibotean, 2014-01-06 09:02 StreamHandler with os.linesep line terminator.
Messages (7)
msg207416 - (view) Author: A. Libotean (alibotean) Date: 2014-01-06 09:02
The StreamHandler implementation uses hardcoded Unix/Linux line separators. This generates inconveniences when running on Windows as the file viewers expect DOS line terminators.

I've attached a fix that will use os.linesep as the line terminator thus making the log files usable with Windows utilities.

Please revise the fix and consider including it.
msg207446 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2014-01-06 15:58
The IO system should automatically take care of the linesep conversion when writing to a text stream.  Are you sure you specified that the output was a text file?
msg208024 - (view) Author: A. Libotean (alibotean) Date: 2014-01-13 11:41
Let me write also a test for this and come back with a reply.
msg208053 - (view) Author: Vinay Sajip (vinay.sajip) * (Python committer) Date: 2014-01-13 22:06
Can you please attach a short test script which shows what you consider to be the failure case / incorrect behaviour?
msg210347 - (view) Author: A. Libotean (alibotean) Date: 2014-02-05 21:27
You can go ahead and close this.

I ran some tests and concluded that indeed the IO system will take care of the line separators.

Sorry to have wasted your time.
msg217064 - (view) Author: Thorsten Weimann (Thorsten.W) Date: 2014-04-23 10:54
Please re-open. The IO system only takes care of line separators, if no encoding is given.
msg217074 - (view) Author: Vinay Sajip (vinay.sajip) * (Python committer) Date: 2014-04-23 15:18
> Please re-open.

This is configurable in Python 3.2 and later using the "terminator" attribute, but this can't be added to 2.7 as it would constitute a new feature.
Date User Action Args
2022-04-11 14:57:56adminsetgithub: 64335
2014-04-23 15:18:07vinay.sajipsetmessages: + msg217074
2014-04-23 10:54:25Thorsten.Wsetnosy: + Thorsten.W
messages: + msg217064
2014-02-05 22:01:26vinay.sajipsetstatus: open -> closed
resolution: not a bug
2014-02-05 21:27:39aliboteansetmessages: + msg210347
2014-01-13 22:06:27vinay.sajipsetmessages: + msg208053
2014-01-13 11:41:00aliboteansetmessages: + msg208024
2014-01-06 15:58:07r.david.murraysetnosy: + r.david.murray, vinay.sajip
messages: + msg207446
2014-01-06 09:02:49aliboteancreate