From: Ford, A. <and...@AG...> - 2006-10-11 18:58:27
|
OK I'm not explaining well. In the docs, at least one example looks something like Log::Log4perl->init($log4perlconfig) or die "Failure reading log config"; Which is great, just what you expect. But when I try the same thing with init_and_watch, I get a false return from init_and_watch=20 ***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... =20 > -----Original Message----- > From: Mike Schilli [mailto:m...@pe...]=20 > Sent: Wednesday, October 11, 2006 1:31 PM > To: Ford, Andy > Cc: log...@li... > Subject: Re: [log4perl-devel] init & init_and_watch behave differently >=20 > On Wed, 11 Oct 2006, Ford, Andy wrote: >=20 > > Looks like init and init_and_watch return differently. > > init_and_watch seems to return false even though the log gets > > initialized. >=20 > Both init() and init_and_watch() will throw an exception if they > fail initializing Log4perl -- they're not returning a meaningful > return code. >=20 > For your test suite, you might want to check sucess by using eval{}: >=20 > eval { > Log::Log4perl->init_and_watch(...); > }; >=20 > if($@) { > # Error! > } else { > # Success! > } >=20 > -- Mike >=20 > Mike Schilli > m...@pe... >=20 > > 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 =3D "/etc/URLbot4.log4perl.conf"; > > Log::Log4perl->init_and_watch($log4perlconfig,'USR2') or=20 > 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=20 > 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... > > > > > > > >=20 > -------------------------------------------------------------- > ----------------------- > > A.G. Edwards & Sons' outgoing and incoming e-mails are=20 > electronically > > archived and subject to review and/or disclosure to someone other > > than the recipient. > > > >=20 > -------------------------------------------------------------- > ----------------------- > > > > > >=20 > -------------------------------------------------------------- > ----------- > > Using Tomcat but need to do more? Need to support web=20 > services, security? > > Get stuff done quickly with pre-integrated technology to=20 > make your job easier > > Download IBM WebSphere Application Server v.1.0.1 based on=20 > Apache Geronimo > >=20 > http://sel.as-us.falkag.net/sel?cmd=3Dlnk&kid=3D120709&bid=3D263057& > dat=3D121642 > > _______________________________________________ > > log4perl-devel mailing list > > log...@li... > > https://lists.sourceforge.net/lists/listinfo/log4perl-devel > > >=20 |