mirror of
https://github.com/Seldaek/monolog.git
synced 2026-04-26 08:05:53 +03:00
[GH-ISSUE #18] GELF handler #4
Labels
No labels
Bug
Documentation
Feature
Needs Work
Support
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/monolog#4
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @jippi on GitHub (Apr 26, 2011).
Original GitHub issue: https://github.com/Seldaek/monolog/issues/18
Hi,
I would like to add a GELF handler to the stack, but I'm missing a feature that you might can help me add.
I plan to use https://github.com/Graylog2/gelf-php as base for the gelf handler
I noticed that addRecord has an "extra" array key, but its unused? Whats the plan for it?
@Seldaek commented on GitHub (Apr 27, 2011):
This looks cool, didn't know of Graylog. What is that feature that is missing?
The extra key btw can be used by Processors to add extra metadata to a record. It's then used by the formatters as they see fit.
@jippi commented on GitHub (Apr 27, 2011):
I think monolog lacks the possibility to add extra data to the log event, besides from severity and message - GELF supports a very rich interface of custom fields and formats.
@Seldaek commented on GitHub (Apr 27, 2011):
Well as I described you can store it in the extra key via a processor, which could itself be attached to the GelfHandler. What kind of data are we talking about here?
@jippi commented on GitHub (Apr 27, 2011):
Could really be anything :)
For example: https://github.com/Graylog2/gelf-php/blob/master/index.php
@Seldaek commented on GitHub (Apr 27, 2011):
Right, well the thing is that the message does not have to be a string actually, so in your application, if you know that you have a gelf handler (and a gelf handler only I'd think), you could pass GELFMessage instances to addRecord(), and have your handler re-use them and eventually add/change some more information like the level etc.
To me though most of that could be achieve via a Processor. I don't have much time right now but maybe next week I can look into this a bit. If you can create a patch for a GelfHandler already it'd be cool. Would be nice to know what the license is on that Gelf-php, if we need to bundle it in Monolog..
@shaneog commented on GitHub (Jul 6, 2011):
Has anyone looked at/worked on this issue? If not I might have a bash at it
@Seldaek commented on GitHub (Jul 6, 2011):
Nope, feel free - there's by the way that new $context argument that was introduced on Logger::addRecord since this issue was created, which could be used to pass an exception object for example, or anything that could be handled by a GelfFormatter to add extra data (backtrace & the like) for the GelfHandler.
@shaneog commented on GitHub (Jul 6, 2011):
I'm just going through the Monolog source now to get a feel for it and will try to work on something in the next couple of days
@Seldaek commented on GitHub (Jul 6, 2011):
Sure, no rush, the goal is to push 1.0 out ASAP anyway, for inclusion in Symfony2.0, then we'll see about adding extra handlers for 1.1.
@mlehner commented on GitHub (Feb 22, 2012):
I wrote a GelfHandler for my own project and am currently using it. I'd love to contribute it back to the community.
My concern is how to package the Gelf specific classes. Right now it's in a separate namespace outside of Monolog. Any suggestions how this should be handled?
@stof commented on GitHub (Feb 22, 2012):
You could create a separate library for Gelf which would be an optional deps for Monolog if these classes make sense without Monolog. Otherwise, simply put them in Monolog, in a
Monolog\Gelfnamespace or something like that@Seldaek commented on GitHub (Apr 22, 2012):
#61 has now been merged, please give it a try.