On Thu, 19 Feb 2009 21:13 -0800, "Mike Schilli" <m...@perlmeister.com>
wrote:
> Actually, just for the record, you can set an appender's layout:
> 
>      $appender->layout($layout); # perldoc Log::Log4perl::Appender

I tried the following code:

    $nl =
     Log::Log4perl::Appender::File->new(
        filename          => $logname,
        mode              => 'clobber',
        utf8              => 1,
        create_at_logtime => 1
     );
    $nl->layout(Log::Log4perl::Layout::PatternLayout->new('%C %m%n'));

But when I write something with $nl->log(...), I don't see the layout
applied.

> > 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

This is valid Perl code????? So I have to the left of the assignment a
catenation, and to the right the comma operator? 

>      # ...
>      log4perl.appender.AnotherAppender.filename = \
>           sub { "mylog." . get_request_name() . ".log" }

Here too I don't understand the syntax. 

> I'm assuming that each 'request' starts the app anew. 

No, the app is running continually during days or weeks in a main loop
and polls 
for new requests. If a request is arriving, it is decomposed into
various pieces. 
Say a request R is coming, followed by request S. The app first is
analyzing R 
and decomposes it into pieces according to some algorithm (let's call
the pieces 
R1, R2, R3). Then it does the next with request S (which might result
into pieces 
S1, S2, S3, S4). Then it schedules the pieces for execution. One
schedule might be: 
R1, S1, S2, R2, S3, S4, R3 and executes them. While some "R"-piece is
executed, logs 
should go to the "R.log" file. While some "S"-piece is executed, logs
should go to 
the "S.log" file.

This is a highly simplified example, and of course there are not only 2
requests
per day, but many more.

Ronald
-- 
Ronald Fischer <rona...@eml.cc>
+  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)


------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
log4perl-devel mailing list
log4perl-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/log4perl-devel

Reply via email to