Closed jippi closed 12 years ago
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.
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.
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?
Could really be anything :)
For example: https://github.com/Graylog2/gelf-php/blob/master/index.php
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..
Has anyone looked at/worked on this issue? If not I might have a bash at it
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.
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
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.
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?
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\Gelf
namespace or something like that
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?