|
From: Mike S. <m...@pe...> - 2009-02-20 05:13:28
|
On Thu, 19 Feb 2009, Ronald Fischer wrote:
>> 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.
Actually, just for the record, you can set an appender's layout:
$appender->layout($layout); # perldoc Log::Log4perl::Appender
> 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.
Add another appender to your category and have it name its log
files according to a function get_request_name() that your
application provides:
log4perl.logger = DEBUG, FooApp, BarApp, AnotherAppender
# ...
log4perl.appender.AnotherAppender.filename = \
sub { "mylog." . get_request_name() . ".log" }
> 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.
I'm assuming that each 'request' starts the app anew. The continually
going logfile appender is in 'append' mode and the request-based logfile
appender is in 'clobber' mode.
-- Mike
Mike Schilli
m...@pe...
|