From: Ronald F. <yn...@mm...> - 2009-02-19 09:16:36
|
> What you think is a 'logger' is really an appender in Log4perl lingo. An > appender has no concept of a level like 'debug', only loggers do. I see, and that's why it also can't understand about layouts. > The reason why you get the error message 'on an undefined value' is an > internal autoload mechanism within the appender that's not defined in > your case. The error message is confusing and needs to be fixed, what it > should say instead is that logdebug() doesn't exist. I see. > Ideally, you would integrate your logging needs into the main log4perl > configuration -- can you explain in more detail why this isn't possible? Maybe it is and I just don't understand Log4perl well enough. We basically have an application which is running permanently (kind of a request server). It accepts requests, processes them, and returns the results. The processing of a single requests typically takes between a couple of minutes, not more than a few hours. The whole application logs its activity to a logfile and to stdout. This is what we have so far, and it is implemented via easy_init (which is, well, easy to use, but maybe not flexible enough): Log::Log4perl->easy_init( {level => $log_level, file => 'STDOUT', layout => '%.1p %d{HH:mm} %M(%L) %m%n' }, {level => $log_level, file => ">$logfile", layout => '%.1p %d{dd.MM. HH:mm:ss (EEE)} %M(%L) %m%n' } ); Now I would like to incorporate the possibility that in addition to that normal, continually going logfile, the logs occuring to each request should be written into a separate, request-specific logfile, so that, if we hav 100 requests on a day, we would end up having 100 extra logfiles in addition to the main logfile. Each of these extra logfiles is named after the request. This means that whenever a new request arrives, we have to create a new logfile. Since the requests are handled in parallel (but non-preemtive, i.e. no threads involved), we have a central "logging handler" which knows which request is the currently active one, and sends each logging event to the standard log, plus to the request-specific one. Any suggestion how I could implement this? Ronald -- Ronald Fischer <ro...@em...> + If a packet hits a pocket on a socket on a port, + and the bus is interrupted and the interrupt's not caught, + then the socket packet pocket has an error to report. + (cited after Peter van der Linden) |