[GH-ISSUE #991] HandlerWrapper isHandling() does not match Logger call to method. #402

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

Originally created by @nesl247 on GitHub (May 24, 2017).
Original GitHub issue: https://github.com/Seldaek/monolog/issues/991

In Logger::addRecord() (https://github.com/Seldaek/monolog/blob/master/src/Monolog/Logger.php#L285) it calls HandlerInterface::isHandling() with only the level, not the record. While HandlerInterface does state this is correct, which is unfortunate, HandlerWrapper seems to be oblivious to this.

See https://github.com/Seldaek/monolog/blob/master/src/Monolog/Handler/HandlerWrapper.php#L21 in which it states you can make different checks against the record. Unfortunately, since it's only the level, HandlerWrapper seems pretty useless according to it's documentation. It looks like handle() needs to actually be overwritten in order to make that determination.

Originally created by @nesl247 on GitHub (May 24, 2017). Original GitHub issue: https://github.com/Seldaek/monolog/issues/991 In `Logger::addRecord()` (https://github.com/Seldaek/monolog/blob/master/src/Monolog/Logger.php#L285) it calls `HandlerInterface::isHandling()` with only the level, not the record. While `HandlerInterface` does state this is correct, which is unfortunate, `HandlerWrapper` seems to be oblivious to this. See https://github.com/Seldaek/monolog/blob/master/src/Monolog/Handler/HandlerWrapper.php#L21 in which it states you can make different checks against the record. Unfortunately, since it's only the level, `HandlerWrapper` seems pretty useless according to it's documentation. It looks like `handle()` needs to actually be overwritten in order to make that determination.
kerem closed this issue 2026-03-04 02:14:45 +03:00
Author
Owner

@Seldaek commented on GitHub (Jun 18, 2017):

Soo... override handle then if you have to override handle? I mean I agree the example is a bit silly but it's just an example, the class can be used to override any method.

<!-- gh-comment-id:309308880 --> @Seldaek commented on GitHub (Jun 18, 2017): Soo... override handle then if you have to override handle? I mean I agree the example is a bit silly but it's just an example, the class can be used to override any method.
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#402
No description provided.