[GH-ISSUE #83] use platform end of line for lineformatter #27

Closed
opened 2026-03-04 02:11:28 +03:00 by kerem · 1 comment
Owner

Originally created by @laurentopprecht on GitHub (May 4, 2012).
Original GitHub issue: https://github.com/Seldaek/monolog/issues/83

Improvement

class LineFormatter implements FormatterInterface
{
const SIMPLE_FORMAT = "[%datetime%] %channel%.%level_name%: %message% %context% %extra%\n";

replaces by

class LineFormatter implements FormatterInterface
{
const SIMPLE_FORMAT = "[%datetime%] %channel%.%level_name%: %message% %context% %extra%" . PHP_EOL;

so that it works better on Windows where end of line is /r/n.

Originally created by @laurentopprecht on GitHub (May 4, 2012). Original GitHub issue: https://github.com/Seldaek/monolog/issues/83 Improvement class LineFormatter implements FormatterInterface { const SIMPLE_FORMAT = "[%datetime%] %channel%.%level_name%: %message% %context% %extra%\n"; replaces by class LineFormatter implements FormatterInterface { const SIMPLE_FORMAT = "[%datetime%] %channel%.%level_name%: %message% %context% %extra%" . PHP_EOL; so that it works better on Windows where end of line is /r/n.
kerem closed this issue 2026-03-04 02:11:29 +03:00
Author
Owner

@Seldaek commented on GitHub (May 5, 2012):

I'm really not sure whether this would be a good thing. This would make the log files platform dependent, which isn't great. In theory most apps should handle all line endings equally well, but in practice this is not the case, so I would say having a unique format across all platform as the default is better. Anyway this is indeed the default, and you are free to use a custom format in your application if you'd rather have different line endings.

Anyway, I wonder what issues you experienced on windows? If it's about opening log files with notepad, I would highly suggest you install Notepad2 - if you pick the "Setup" version it will replace windows' default Notepad by this one which is really superior in all ways.

<!-- gh-comment-id:5529514 --> @Seldaek commented on GitHub (May 5, 2012): I'm really not sure whether this would be a good thing. This would make the log files platform dependent, which isn't great. In theory most apps should handle all line endings equally well, but in practice this is not the case, so I would say having a unique format across all platform as the default is better. Anyway this is indeed the default, and you are free to use a custom format in your application if you'd rather have different line endings. Anyway, I wonder what issues you experienced on windows? If it's about opening log files with notepad, I would highly suggest you install [Notepad2](http://www.flos-freeware.ch/notepad2.html) - if you pick the "Setup" version it will replace windows' default Notepad by this one which is really superior in all ways.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/monolog#27
No description provided.