On Fri, 20 Feb 2009, Ronald Fischer wrote:

> 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'));

That won't work, you have to use Log4perl's appender wrapper around the
real appender -- but this is just a theoretical exercise, I don't really
recommend playing with Log4perl's internals.

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

Of course not, it's l4p config syntax.

>>      # ...
>>      log4perl.appender.AnotherAppender.filename = \
>>           sub { "mylog." . get_request_name() . ".log" }
>
> Here too I don't understand the syntax.

The right-hand side of an assignment in l4p config syntax can be a 
perl code reference.

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

That's alright, just a subroutine like get_request_name() shown above
accordingly, so that it returns a unique name for every unique request
or subrequest.

-- Mike

Mike Schilli
m...@perlmeister.com

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