|
From: Mike S. <m...@pe...> - 2006-10-11 18:31:14
|
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
>
|