[GH-ISSUE #1915] ErrorHandler::register not working as expected #821

Closed
opened 2026-03-04 03:01:00 +03:00 by kerem · 4 comments
Owner

Originally created by @kaihendry on GitHub (Sep 21, 2024).
Original GitHub issue: https://github.com/Seldaek/monolog/issues/1915

Monolog version 3.7

https://gist.github.com/kaihendry/6ad32ed135e3d679e6dd896365b252cb

The error handler is not working as expected, it shows:

  {"level":"info","ts":1726946030.4808884,"msg":"capture me monolog","syslog_level":"notice"}
Originally created by @kaihendry on GitHub (Sep 21, 2024). Original GitHub issue: https://github.com/Seldaek/monolog/issues/1915 Monolog version 3.7 https://gist.github.com/kaihendry/6ad32ed135e3d679e6dd896365b252cb The error handler is not working as expected, it shows: {"level":"info","ts":1726946030.4808884,"msg":"capture me monolog","syslog_level":"notice"}
kerem 2026-03-04 03:01:00 +03:00
  • closed this issue
  • added the
    Support
    label
Author
Owner

@stof commented on GitHub (Sep 24, 2024):

what do you mean by "it is not working as expected" ?

<!-- gh-comment-id:2371060416 --> @stof commented on GitHub (Sep 24, 2024): what do you mean by "it is not working as expected" ?
Author
Owner

@kaihendry commented on GitHub (Sep 24, 2024):

I expected monolog to hook into error_log

<!-- gh-comment-id:2371153305 --> @kaihendry commented on GitHub (Sep 24, 2024): I expected monolog to hook into `error_log`
Author
Owner

@stof commented on GitHub (Sep 24, 2024):

PHP's error_log function does not report its messages to the PHP error handler system. It directly sends it to the PHP system logger, which is not hookable in userland.

<!-- gh-comment-id:2371220187 --> @stof commented on GitHub (Sep 24, 2024): PHP's `error_log` function does not report its messages to the PHP error handler system. It directly sends it to the PHP system logger, which is not hookable in userland.
Author
Owner

@Seldaek commented on GitHub (Nov 9, 2024):

Right the way to trigger it is to call trigger_error().. But really if you wanna trigger the logger, please call the logger :)

<!-- gh-comment-id:2466214390 --> @Seldaek commented on GitHub (Nov 9, 2024): Right the way to trigger it is to call trigger_error().. But really if you wanna trigger the logger, please call the logger :)
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#821
No description provided.