I want to have two log files:
* main.log, which gets all INFO and above messages in the system
* session.log, which gets all DEBUG and above messages in the  
My.Session package

Here's what I tried:

    log_dir = /Users/swartz/perl/log4perl/dup
    log_layout = %d{dd/MMM/yyyy:HH:mm:ss.SS} [%p] %c - %m - %F:%L -  
%X{script_name} - %P-%X{request_id}%n

    log4perl.logger                                 = INFO, main
    log4perl.appender.main                          =  
Log::Log4perl::Appender::File
    log4perl.appender.main.filename                 = ${log_dir}/ 
main.log
    log4perl.appender.main.layout                   = PatternLayout
    log4perl.appender.main.layout.ConversionPattern = ${log_layout}

    log4perl.logger.My.Session                         = DEBUG, session
    log4perl.appender.session                          =  
Log::Log4perl::Appender::File
    log4perl.appender.session.filename                 = ${log_dir}/ 
session.log
    log4perl.appender.session.layout                   = PatternLayout
    log4perl.appender.session.layout.ConversionPattern = ${log_layout}

with this script:

    #!/usr/bin/perl
    use Log::Log4perl;
    use warnings;
    use strict;
    Log::Log4perl::init('log.conf');

    my $log = Log::Log4perl->get_logger('My.Session');
    $log->debug('session message');

But it logs 'session message' to both main.log and session.log, which  
is somewhat surprising since the main.log section was set for 'INFO'.

Is there a way for the My.Session debug messages to only go to  
session.log, not to main.log?

Thanks!
Jon


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
log4perl-devel mailing list
log4perl-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/log4perl-devel

Reply via email to