logo       
Google Custom Search
    AddThis Social Bookmark Button
-->

Re: appender initialisation issue: msg#00008

Subject: Re: appender initialisation issue
My logging situation is complex - the pseudo-code looks like this:

<initialise main log>
log to main log
:                 : 
for 1 to n of builds
      log to main log
      :                :
       <swap for local log for building component>
      log to local log
      :               :
      <swap to main log>
      log to main log
      :              :

so I'm swapping appenders every so often, which is why I didn't use 
Log::Log4perl->init. In fact, I destroy the previous local-log appender. 
Or maybe I could us Log::Log4perl->init every time?

Cheers
Roger
At 15/06/2006 07:52:05, Mike Schilli <m@xxxxxxxxxxxxxxx> wrote:
>On Wed, 14 Jun 2006, Roger Day wrote:
>
>>   my $appender = Log::Log4perl::Appender->new(
>>                                               "Log::Dispatch::File",
>>                                               filename => 
$main_logpath,
>>                                               mode     => "append",
>>                                               name
>> =>$current_appender_name,
>>                                               level=>$INFO
>>                                              );
>>
>> I'm doing this, but it doesn't seem to change the level of 
initialisation.
>> Am I doing something wrong?
>
>I'd recommend using a Log4perl configuration file and the file
>appender that comes with Log::Log4perl:
>
>use Log::Log4perl qw(:easy);
>
>my $conf = q{
>log4perl.category              = DEBUG, Logfile
>log4perl.appender.Logfile      = Log::Log4perl::Appender::File
>log4perl.appender.Logfile.mode = append
>log4perl.appender.Logfile.filename = /tmp/test.log
>log4perl.appender.Logfile.layout = Log::Log4perl::Layout::PatternLayout
>log4perl.appender.Logfile.layout.ConversionPattern = %d %F{1} %L> %m%n
>};
>
>Log::Log4perl->init(\$conf);
>DEBUG "Hey there!";
>
>If you really need to use Log::Dispatch::File and the L4p API, here's
>what I think you had in mind:
>
>use Log::Log4perl qw(get_logger :levels);
>
>my $logger = get_logger("");
>my $appender = Log::Log4perl::Appender->new(
>"Log::Dispatch::File",
>filename  =>  "woot.txt",
>mode      => "append",
>name      => "quack",
>min_level => "debug",
>);
>$logger->add_appender($appender);
>
>$logger->debug("waaa!");
>
>-- Mike
>
>Mike Schilli
>m@xxxxxxxxxxxxxxx
>


<Prev in Thread] Current Thread [Next in Thread>