[GH-ISSUE #256] Use CubeHandler with other handlers #87

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

Originally created by @sagikazarmark on GitHub (Oct 26, 2013).
Original GitHub issue: https://github.com/Seldaek/monolog/issues/256

This is probably not an issue, but a real use case which causes a problem for me.

I am writting a queue management package, and I am using PSR3 compatible logging. I would like to make it work with Cube server, so I was very happy when I realized that monolog supports it. Probably everyone will use monolog as the logger, but the chance is given to use own written loggers.

Now I am passing a Logger object to the worker and this logs failures, succes messages, etc.

I started to implement logging a Cube compatible message (type, job payload, etc), but I stopped, because I realized, that this way the Cube server also gets all other log messages, which is wrong.

I could log everything over debug level and preserve the debug level for cube messages but that is ugly. :-)

My ideas: pass a second logger interface to worker which contains only a cube handler or solve connection to cube server without logger.

I don't like any of above, so I am asking you. Do you have any ideas how it could be solved by using PSR3 logger, which generally means monolog?

Thanks in advance

Originally created by @sagikazarmark on GitHub (Oct 26, 2013). Original GitHub issue: https://github.com/Seldaek/monolog/issues/256 This is probably not an issue, but a real use case which causes a problem for me. I am writting a queue management package, and I am using PSR3 compatible logging. I would like to make it work with Cube server, so I was very happy when I realized that monolog supports it. Probably everyone will use monolog as the logger, but the chance is given to use own written loggers. Now I am passing a Logger object to the worker and this logs failures, succes messages, etc. I started to implement logging a Cube compatible message (type, job payload, etc), but I stopped, because I realized, that this way the Cube server also gets all other log messages, which is wrong. I could log everything over debug level and preserve the debug level for cube messages but that is ugly. :-) My ideas: pass a second logger interface to worker which contains only a cube handler or solve connection to cube server without logger. I don't like any of above, so I am asking you. Do you have any ideas how it could be solved by using PSR3 logger, which generally means monolog? Thanks in advance
kerem closed this issue 2026-03-04 02:12:04 +03:00
Author
Owner

@Seldaek commented on GitHub (Oct 28, 2013):

One thing could be to have a special handler wrapping the existing handler(s) that would filter out log records that are|are not cube messages. That way you could send everything to one logger and sort of route records to the right handler. It's not something that is possible with monolog natively though, you would have to write your own handler or extend the Logger to support such use case.

<!-- gh-comment-id:27197024 --> @Seldaek commented on GitHub (Oct 28, 2013): One thing could be to have a special handler wrapping the existing handler(s) that would filter out log records that are|are not cube messages. That way you could send everything to one logger and sort of route records to the right handler. It's not something that is possible with monolog natively though, you would have to write your own handler or extend the Logger to support such use case.
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#87
No description provided.