logo       
Google Custom Search
    AddThis Social Bookmark Button
-->

RE: How to alter threshold for appender on a per-logger basis at runtime: msg#00004

Subject: RE: How to alter threshold for appender on a per-logger basis at runtime
> From: Mike Schilli [mailto:m@xxxxxxxxxxxxxxx] 
>
>     my $logger = get_logger("mycat");
> 
>     $logger->debug("both appenders");
> 
>     Log::Log4perl->appender_thresholds_adjust(+1, ['Screen1']);
> 
>     $logger->debug("one appender");
>     $logger->info("both appenders again");

Thanks. I think will work for what I need to do, but just to be
completely clear, if I understand this correctly, you may only adjust
the appender threshold on a per-appender basis, not per
category/appender pair, so the following WON'T work:

    my $conf = q{
    log4perl.logger.mycat = DEBUG, Screen1, Screen2
    log4perl.logger.another_cat = DEBUG, Screen1, Screen2

    log4perl.appender.Screen1   = Log::Log4perl::Appender::Screen
    log4perl.appender.Screen1.layout = SimpleLayout
    log4perl.appender.Screen1.Threshold = DEBUG

    log4perl.appender.Screen2   = Log::Log4perl::Appender::Screen
    log4perl.appender.Screen2.layout = SimpleLayout
    log4perl.appender.Screen2.Threshold = DEBUG
    };

    Log::Log4perl->init(\$conf);

    my $logger = get_logger("mycat");
    my $another_logger = get_logger("different_cat");

    $logger->debug("both appenders");
    Log::Log4perl->appender_thresholds_adjust(+1, ['Screen1']);

    $logger->debug("one appender");
    $logger->info("both appenders again");
    $another_logger->debug("both appenders"); # Uh oh, goes to only
Screen2 
 
This message and any attachments are confidential, proprietary, and may be 
privileged.  If this message was misdirected, Barclays Global Investors (BGI) 
does not waive any confidentiality or privilege.  If you are not the intended 
recipient, please notify us immediately and destroy the message without 
disclosing its contents to anyone.  Any distribution, use or copying of this 
e-mail or the information it contains by other than an intended recipient is 
unauthorized.  The views and opinions expressed in this e-mail message are the 
author's own and may not reflect the views and opinions of BGI, unless the 
author is authorized by BGI to express such views or opinions on its behalf.  
All email sent to or from this address is subject to electronic storage and 
review by BGI.  Although BGI operates anti-virus programs, it does not accept 
responsibility for any damage whatsoever caused by viruses being passed.


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid3432&bid#0486&dat1642


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