[GH-ISSUE #1625] How do I output level as the level name instead of the constant value? #690

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

Originally created by @LeoAdamek on GitHub (Jan 11, 2022).
Original GitHub issue: https://github.com/Seldaek/monolog/issues/1625

How do I have my output (when using the JSONFormatter) output the level name (e.g. info) in the level field, rather than the level constant value (e.g. 200)? My log management tools don't understand the numeric levels so don't display the logs properly.

I tried using a processor to copy the level_name value to level but this caused other handlers/formatters etc which used the level value to error.

Originally created by @LeoAdamek on GitHub (Jan 11, 2022). Original GitHub issue: https://github.com/Seldaek/monolog/issues/1625 How do I have my output (when using the `JSONFormatter`) output the level _name_ (e.g. info) in the `level` field, rather than the level constant value (e.g. 200)? My log management tools don't understand the numeric levels so don't display the logs properly. I tried using a processor to copy the `level_name` value to `level` but this caused other handlers/formatters etc which used the level value to error.
kerem 2026-03-04 02:17:02 +03:00
  • closed this issue
  • added the
    Support
    label
Author
Owner

@Seldaek commented on GitHub (Mar 7, 2022):

I would say write your own formatter that does what you need.

<!-- gh-comment-id:1060686194 --> @Seldaek commented on GitHub (Mar 7, 2022): I would say write your own formatter that does what you need.
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#690
No description provided.