I inherited an existing Log4perl configuration, and I think I'm
missing some key point.

The config file starts out:

log4perl.rootLogger = INFO, syslogAppender, screenAppender

>From the examples I've seen and the ::Config docs I thought it should
be "log4perl.logger" not "log4perl.rootLogger".

Yet, logging is working as expected.  So, I'm curious about the
difference.

In ::Config it also give these examples:

    log4perl.logger.Bar.Twix = DEBUG, A1


    log4perl.category.Bar.Twix      = WARN, Screen

Why is it "category" instead of "logger"?


Finally, for a config like this in the example, what would
be the perl code equivalent if not using a config file?


    log4perl.logger.Bar.Twix = DEBUG, A1
    log4perl.appender.A1=Log::Log4perl::Appender::File
    log4perl.appender.A1.filename=test.log
    log4perl.appender.A1.mode=append
    log4perl.appender.A1.layout = \
        Log::Log4perl::Layout::PatternLayout
    log4perl.appender.A1.layout.ConversionPattern = %d %m %n


Like this?

    use Log::Log4perl qw(:levels);
    use Log::Log4perl::Appender::File;

    my $appender = Log::Log4perl::Appender::File->new(
      filename  => 'test.log',
      mode      => 'append',
      layout    => Log::Log4perl::Layout::PatternLayout->new( '%d %m %n'),
    );

    my $logger = Log::Log4perl->get_logger( 'Bar::Twix' );

    $logger->level( $DEBUG );
    $logger->add_appender( $appender );






-- 
Bill Moseley
[EMAIL PROTECTED]


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