On Thu, 22 May 2008, Craig wrote:

> Problem is that I need to *always* send info (and "up") messages to the
> file and error (and "up") to stderr regardless of what the root logger
> level is set to. But, I also need to be able to change the stdout level
> on the fly. I don't want to set the default root level to anything less
> than ERROR, which means that only error and up will then be sent to the
> file.

Not sure I understand why it's a requirement that the root logger's
level is not set to anything less than ERROR.

If you want INFO messages to go through, you can't close the first gate,
keep the messages out and hope that the second gate (the filter)
magically resurrects them -- that doesn't make sense.

Why aren't you simply setting the logger to the lowest level you're
interested in (INFO if I understood correctly) and handle the messages
you don't want in the appenders with a threshold setting?

    http://log4perl.sourceforge.net/d/Log/Log4perl/FAQ.html#245ae

-- Mike

Mike Schilli
[EMAIL PROTECTED]

>
> I have an app where I want to log the following:
>       stdout: ERROR
>       stderr: ERROR
>       file: INFO
> Also, I need to be able to change the level for stdout during run-time.
>
> I have a simple test script with the following config:
>
> $conf = {
    > 'log4perl.logger' => "ERROR, Screen, OutError, File",
    >
        > 'log4perl.filter.Info' => 'Log::Log4perl::Filter::LevelRange',
    > 'log4perl.filter.Info.LevelMin' => 'INFO',
    > 'log4perl.filter.Info.LevelMax' => 'FATAL',
    > 'log4perl.filter.Info.AcceptOnMatch' => 'true',
    >
        > 'log4perl.filter.Warn' => 'Log::Log4perl::Filter::LevelRange',
    > 'log4perl.filter.Warn.LevelMin' => 'WARN',
    > 'log4perl.filter.Warn.LevelMax' => 'FATAL',
    > 'log4perl.filter.Warn.AcceptOnMatch' => 'true',
    >
        > "log4perl.appender.Screen" => "Log::Log4perl::Appender::Screen",
    > "log4perl.appender.Screen.stderr"  => "0",
    > "log4perl.appender.Screen.layout" => 
"Log::Log4perl::Layout::PatternLayout",
    > "log4perl.appender.Screen.layout.ConversionPattern" => 'ok: %p>%M-%L: 
%m%n',
    >
        > "log4perl.appender.OutError" => "Log::Log4perl::Appender::Screen",
    > "log4perl.appender.OutError.Filter" => 'Warn',
    > "log4perl.appender.OutError.stderr"  => "1",
    > "log4perl.appender.OutError.layout" =>
        > "Log::Log4perl::Layout::PatternLayout",
    > "log4perl.appender.OutError.layout.ConversionPattern" => 'ok: %p>%M-%L:
        > %m%n',
    >
        > "log4perl.appender.File" => "Log::Log4perl::Appender::File",
    > "log4perl.appender.File.Filter" => 'Info',
    > "log4perl.appender.File.mode" => 'append',
    > "log4perl.appender.File.filename" => "app-multi.log",
    > "log4perl.appender.File.layout" => "Log::Log4perl::Layout::PatternLayout",
    > "log4perl.appender.File.layout.ConversionPattern" => '%p>%M-%L: %m%n'
        > };
> Log::Log4perl::init($conf);
> $logger = get_logger($name);
>
> ...
> #########################
>

> (Basically, I have a "verbose" switch on the app where I turn down the
        > level for stdout. But, the default should be pretty non-chatty.)
    >
> Does this all make sense? (Not sure if I explained it very well.)
    >
    > Any ideas would be appreciated!
    >
    > Thanx
    > Craig
    >
    >
    > -------------------------------------------------------------------------
    > This SF.net email is sponsored by: Microsoft
    > Defy all challenges. Microsoft(R) Visual Studio 2008.
    > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
    > _______________________________________________
    > log4perl-devel mailing list
    > log4perl-devel@lists.sourceforge.net
    > https://lists.sourceforge.net/lists/listinfo/log4perl-devel
    >

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
log4perl-devel mailing list
log4perl-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/log4perl-devel

Reply via email to