From: Mike S. <m...@pe...> - 2006-10-11 19:32:22
|
On Wed, 11 Oct 2006, Ford, Andy wrote: > In the docs, at least one example looks something like > Log::Log4perl->init($log4perlconfig) or die "Failure reading log > config"; That's a typo, it'll be corrected in 1.07. > Which is great, just what you expect. It works differently, though. Both init() and init_and_watch() will die() on error. -- Mike Mike Schilli m...@pe... > > But when I try the same thing with init_and_watch, I get a false return > from init_and_watch > ***even when it succeeds***, as demonstrated by the > Log::Log4perl->initialized() call that follows. > > This would not seem to be the desired behavior. > > Upgraded my log4perl 1.03 -> 1.06, but still the same. > > Andy Ford > and...@ag... > > > > -----Original Message----- > > From: Mike Schilli [mailto:m...@pe...] > > Sent: Wednesday, October 11, 2006 1:31 PM > > To: Ford, Andy > > Cc: log...@li... > > Subject: Re: [log4perl-devel] init & init_and_watch behave differently > > > > On Wed, 11 Oct 2006, Ford, Andy wrote: > > > > > Looks like init and init_and_watch return differently. > > > init_and_watch seems to return false even though the log gets > > > initialized. > > > > Both init() and init_and_watch() will throw an exception if they > > fail initializing Log4perl -- they're not returning a meaningful > > return code. > > > > For your test suite, you might want to check sucess by using eval{}: > > > > eval { > > Log::Log4perl->init_and_watch(...); > > }; > > > > if($@) { > > # Error! > > } else { > > # Success! > > } > > > > -- Mike > > > > Mike Schilli > > m...@pe... > > > > > Here's test program that illustrates. > > > On my system, (Log4perl 1.03, HP-UX 11, perl 5.8.7), I get > > > > > > Failure reading log config /etc/URLbot4.log4perl.conf: at > > > /home/forda/Log4perlBug line 6. > > > well OK > > > well OK > > > > > > #!/usr/local/perl-5.8.7/bin/perl > > > use warnings; > > > use strict; > > > use Log::Log4perl qw(get_logger :levels :no_extra_logdie_message); > > > my $log4perlconfig = "/etc/URLbot4.log4perl.conf"; > > > Log::Log4perl->init_and_watch($log4perlconfig,'USR2') or > > warn "Failure > > > reading log config $log4perlconfig: $!"; > > > if(Log::Log4perl->initialized()) { > > > # Yes, Log::Log4perl has already been initialized > > > print "well OK\n"; > > > } else { > > > die "logs unitialized...: $!"; > > > } > > > Log::Log4perl->init($log4perlconfig) or warn "Failure > > reading log config > > > $log4perlconfig: $!"; > > > if(Log::Log4perl->initialized()) { > > > # Yes, Log::Log4perl has already been initialized > > > print "well OK\n"; > > > } else { > > > die "logs unitialized...: $!"; > > > } > > > > > > Andy Ford > > > EEMS > > > x56647 > > > and...@ag... > > > > > > > > > > > > > > -------------------------------------------------------------- > > ----------------------- > > > A.G. Edwards & Sons' outgoing and incoming e-mails are > > electronically > > > archived and subject to review and/or disclosure to someone other > > > than the recipient. > > > > > > > > -------------------------------------------------------------- > > ----------------------- > > > > > > > > > > > -------------------------------------------------------------- > > ----------- > > > Using Tomcat but need to do more? Need to support web > > services, security? > > > Get stuff done quickly with pre-integrated technology to > > make your job easier > > > Download IBM WebSphere Application Server v.1.0.1 based on > > Apache Geronimo > > > > > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057& > > dat=121642 > > > _______________________________________________ > > > log4perl-devel mailing list > > > log...@li... > > > https://lists.sourceforge.net/lists/listinfo/log4perl-devel > > > > > |