From: Kevin G. <ke...@go...> - 2003-02-11 17:05:34
|
That's an interesting point, return codes. If init() has any problems=20 it will die, otherwise the program might continue with a=20 half-initialized logger, with undefined results. Not everybody is as=20 conscientous as yourself in checking return codes, and we didn't see any=20 point in failing init() but continuing the program. So the answer to your question is don't check the return code from init.=20 If you want to catch init() in the act of dying, you can use the=20 try/catch paradigm eval { Log::Log4perl->init($LogConfFile)=09 }; if ($@){ die "Log4perl died with this message: $@"; } Tim M=FCller-Seydlitz wrote: > Hi, > please allow this newbie question. >=20 > I am trying to run the following initialization with log4perl. >=20 > use Log::Log4perl qw(get_logger); > Log::Log4perl->init($LogConfFile) or die "Log configuration cannot be=20 > read from file $LogConfFile!"; > my $logger =3D get_logger("MD::NetScheduler"); >=20 > Unfortunately init does not return true, even though the $LogConfFile=20 > definitely exists. > Its content is here: >=20 > log4perl.rootLogger=3DDEBUG, LOGFILE >=20 > log4perl.appender.LOGFILE=3DLog::Dispatch::File > log4perl.appender.LOGFILE.filename=3D/home/mdnet/log/myerrs.log > log4perl.appender.LOGFILE.mode=3Dappend >=20 > log4perl.appender.LOGFILE.layout=3DPatternLayout > log4perl.appender.LOGFILE.layout.ConversionPattern=3D%d %6p %20c=20 > %15F{1}:%5L - %m %n >=20 > Your help is very much appreciated. > I am running Log4perl 0.29 >=20 > Regards > Tim >=20 >=20 >=20 > ------------------------------------------------------- > This SF.NET email is sponsored by: > SourceForge Enterprise Edition + IBM + LinuxWorld =3D Something 2 See! > http://www.vasoftware.com > _______________________________________________ > log4perl-devel mailing list > log...@li... > https://lists.sourceforge.net/lists/listinfo/log4perl-devel --=20 Happy Trails . . . Kevin M. Goess (and Anne and Frank) 904 Carmel Ave. Albany, CA 94706 (510) 525-5217 |