Sorry to reply to such a long and thoughtful e-mail with a URI, but do 
you think being given access to the raw data would give you sufficient 
means to format it?

http://log4perl.sourceforge.net/releases/Log-Log4perl/docs/html/Log/Log4perl/FAQ.html#e8a46

Could you then forward the formatted data to an appender of your 
choice/via appenders listed in the config?

Lee

On 14/03/2013 17:25, Dmitry Bigunyak wrote:
> Hi there!
>
> I was searching the mailing-list history but didn't find any topics related 
> to the subject I'd like to discuss. Maybe I didn't look close enough, sorry 
> if so.
> Anyway, the subject I want to discuss is how to use log4perl for structured 
> logging.
> There are a couple of modules on CPAN related to this task, like for example 
> Log::Log4perl::Layout::GELF, Log::Log4perl::Appender::Fluent or 
> Log::Message::JSON. But different approaches implemented there gave me the 
> impression that there is no a general convenient way of doing structured 
> logging in log4perl.
> Yes, you can pass an arbitrary list of parameters to the logger and it really 
> depends on the appender if it can work with that or not,  
> Log::Log4perl::Appender::DBI is a good example of how to do that. But what if 
> I want to log my data to database, log file and lets say ElasticSearch at the 
> same time. The problem here is that all three appenders expect data in 
> different formats, File appender expects to get a string, DBI - a list of 
> parameters and ElasticSearch - JSON. This is the place where you get stuck 
> and has to choose something one.
> The Log::Message::JSON module, as I understand it, is trying to address the 
> problem using objects which get serialized to JSON in appenders expecting 
> stings. But calling a special function (logmsg) every time you log something 
> is quite a hassle and this is only JSON, what if I want to use XML? Here we 
> go, there is no way in log4perl you can format you data before they are 
> passed to appender. Layouts are meant to render messages, not arbitrary data. 
> I also was trying to play with the warp_message appender option but it's 
> result is always an array ref which doesn't work with File appender for 
> example and it's probably not the best way to solve the problem.
> To don't introduce new entities I'd say that Layouts is a proper place to 
> make such transformations but it is just not how things work now.
>
> Can someone suggest a good solution for that or maybe an idea?
> What are you thoughts in general on the problem, should it be solved in 
> log4perl?
> Thanks.
> --
> Dmitry
> e-mail: ices...@inbox.ru
> ------------------------------------------------------------------------------
> Everyone hates slow websites. So do we.
> Make your web apps faster with AppDynamics
> Download AppDynamics Lite for free today:
> http://p.sf.net/sfu/appdyn_d2d_mar
> _______________________________________________
> log4perl-devel mailing list
> log4perl-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/log4perl-devel


------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_mar
_______________________________________________
log4perl-devel mailing list
log4perl-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/log4perl-devel

Reply via email to