This is the condensed code of my application just for demonstrating my problem:
use strict; use warnings; use Log::Log4perl qw(:easy); use Log::Log4perl::Appender::File; Log::Log4perl->easy_init({file=>'STDOUT',layout => '%d{HH:mm} %m%n', level=>$DEBUG}); my $logger=Log::Log4perl::Appender::File->new(filename => "dummy.log", mode => 'clobber'); $logger->log(message=>"test\n"); $logger->layout(Log::Log4perl::Layout::PatternLayout->new('%c %C %m%n')); $logger->log(message => "abc"); $logger->logdebug('xyz'); Reason for this probably slightly unusual way of using Log::Log4perl is the following: My application uses one common logging facility (hence the easy_init). Certain parts of the application want to create occasionally their various other logfiles with their own layout and shorter lifetime than the common logging system (demonstrated here by the variable $logger). Running this program results in a file dummy.log containing test abc and the message Can't call method "logdebug" on an undefined value Now my questions: (1) Why does the second call to log() not obey the pattern layout I have defined the line before? After all, a Appender::File inherits from Appender, and hence layout() should have the desired effect. (2) Why does the error message say "on an undefined value", when $logger (the object where method is called on) is obviously not undefined? (3) I guess one of my mistakes is that Appender::File is not a suitable logger type for my purpose. Should I use a different logger instead, and if yes, which one? Ronald -- Ronald Fischer <austria_ru...@yepmail.net> There are 10 types of people in the world: those who understand binary and those who don't. ------------------------------------------------------------------------------ Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA -OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise -Strategies to boost innovation and cut costs with open source participation -Receive a $600 discount off the registration fee with the source code: SFAD http://p.sf.net/sfu/XcvMzF8H _______________________________________________ log4perl-devel mailing list log4perl-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/log4perl-devel