[GH-ISSUE #1892] Log level not compliant with rfc5424 #810

Open
opened 2026-03-04 02:18:13 +03:00 by kerem · 2 comments
Owner

Originally created by @anthosz on GitHub (May 31, 2024).
Original GitHub issue: https://github.com/Seldaek/monolog/issues/1892

Hello,

Following https://github.com/Seldaek/monolog/blob/main/doc/01-usage.md#log-levels:
image

There is strange level for each severity especially if it's supposed to be compliant with rfc5424.

In fact, it's not really the case. According to https://datatracker.ietf.org/doc/html/rfc5424#section-6.2.1 (table 2): "Severity values MUST be in the range of 0 to 7 inclusive."

Could you please change it?

It can lead to some issues during parsing from some log parsers ootb.

Thank you!

Originally created by @anthosz on GitHub (May 31, 2024). Original GitHub issue: https://github.com/Seldaek/monolog/issues/1892 Hello, Following https://github.com/Seldaek/monolog/blob/main/doc/01-usage.md#log-levels: ![image](https://github.com/Seldaek/monolog/assets/14294064/6bb13551-58f0-4e21-ac87-e3a5e2a7c646) There is strange level for each severity especially if it's supposed to be compliant with rfc5424. In fact, it's not really the case. According to https://datatracker.ietf.org/doc/html/rfc5424#section-6.2.1 (table 2): "**Severity values MUST be in the range of 0 to 7 inclusive.**" Could you please change it? It can lead to some issues during parsing from some log parsers ootb. Thank you!
Author
Owner

@Seldaek commented on GitHub (Jun 28, 2024):

You can make sure your formatters use $record->level->toRFC5424Level() to format stuff to get compliant levels if you care about the actual level used. The syslog formatter for example uses that.

The internal levels are the way they are for BC reasons and I don't think they should be changed. Maybe something for v4 though if we could add a way to opt-in to it in v3 ideally.. I'll leave this open for now as reminder.

<!-- gh-comment-id:2196477617 --> @Seldaek commented on GitHub (Jun 28, 2024): You can make sure your formatters use `$record->level->toRFC5424Level()` to format stuff to get compliant levels if you care about the actual level used. The syslog formatter for example uses that. The internal levels are the way they are for BC reasons and I don't think they should be changed. Maybe something for v4 though if we could add a way to opt-in to it in v3 ideally.. I'll leave this open for now as reminder.
Author
Owner

@anthosz commented on GitHub (Jun 28, 2024):

Thank you for your feedback and let's see :)

<!-- gh-comment-id:2196490457 --> @anthosz commented on GitHub (Jun 28, 2024): Thank you for your feedback and let's see :)
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#810
No description provided.