Re: [log4perl-devel] Problems with uninitialized root-logger in log::log4perl
Hi, Mike Schilli schrieb: > On Fri, 23 Nov 2007, Johannes Kilian wrote: > >> Using my "traditional" log4perl configuration file (used from 0.51 >> on) the 1.12 Version shows following behaviour (which I didn't >> notice with earlier versions ...): >> 1.) Initializing log4perl works without any errors >> 2.) Getting loggers works without any errors >> 3.) Using $logger->logdie(...) (and other functions dieing, like >> $logger->error_die(...)) makes the program die IMMEDIATELY; I'm not able to >> catch the die-exception within an eval{} block -> WHY??? - I'm sure it >> worked with earlier versions of log4perl .. > > Hmm, the following works for me: > > use Log::Log4perl qw(:easy); > Log::Log4perl->easy_init($DEBUG); > > eval { > LOGDIE "Waah!"; > }; > > print "Survived!\n"; > > and prints > > 2007/11/30 17:38:48 Waah! > Survived! > > Do you have a __DIE__ handler defined somewhere by any chance? > No - no __DIE__ handler within my own perl-modules/perl files. Perhaps there might be some troublesome __DIE__ handler within the officiall perl modules (installed in Perl\lib or Perl\site\lib) - But how can I find out which one is it? > >> 4.) Finishing my program an error from log4perl occurs: (in cleanup) >> Internal error: Root Logger not initialized. at >> C:/Programme/Perl/site/lib/Log/Log4perl/Logger.pm line 557 during global >> destruction. >> How can I avoid the internal error above? Perhaps the uninitialized root logger causes the erroneous exception handling as described in point 3.)? Thanks Johannes - SF.Net email is sponsored by: The Future of Linux Business White Paper from Novell. From the desktop to the data center, Linux is going mainstream. Let it simplify your IT future. http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4 ___ log4perl-devel mailing list log4perl-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/log4perl-devel
Re: [log4perl-devel] Log::Log4Perl::Util::module_available broken...
Quoting Mike Schilli ([EMAIL PROTECTED]): > > Yeah, that's an old issue that dates back to Log4perl 0.42: There we > figured out that if someone wrote > > $SIG{__DIE__} = sub { print "die handler!\n"; }; > > and used Log4perl and some module like Time::HiRes is missing, which > is acceptable, the handler gets triggered because eval { require } > causes an exception. Confusion ensued. > Ok, so you have a good reason for attempting this, which is great to know. I was really wondering why you would do this. > Now, I've always thought that this is a bug in perl, nobody writes die > die handlers 'correctly'. To comply with users who get confused with this > confusing behaviour, I put this module_available() hack in place, which, > admittedly, sucks. > ;-) > What to do? Going back to eval { require } would break every user with > sloppy die handlers. > No, if you read the patch on rt closely, you will see it puts a 'local' die handler in place, just for the scope of the eval. This will temporarily override all other die handlers, safely do an eval and then return the result and unmask the users die handlers afterwards. This is entirely safe to do and the eval will not trigger the users die handlers anymore. You can just apply the patch as is and you will not break users code. Regards, -- Merijn Broeren | We take risks, we know we take them. Therefore, when things | come out against us, we have no cause for complaint. | - Scott, last journal entry, march 1912 - SF.Net email is sponsored by: The Future of Linux Business White Paper from Novell. From the desktop to the data center, Linux is going mainstream. Let it simplify your IT future. http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4 ___ log4perl-devel mailing list log4perl-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/log4perl-devel
Re: [log4perl-devel] Problems with uninitialized root-logger in log::log4perl
On Tue, 4 Dec 2007, Johannes Kilian wrote: > No - no __DIE__ handler within my own perl-modules/perl files. Perhaps > there might be some troublesome __DIE__ handler within the officiall > perl modules (installed in Perl\lib or Perl\site\lib) - But how can > I find out which one is it? Trace it: PERLDB_OPTS="NonStop=1 AutoTrace=1 frame=2" perl -dS program > >> 4.) Finishing my program an error from log4perl occurs: (in cleanup) > >> Internal error: Root Logger not initialized. at > >> C:/Programme/Perl/site/lib/Log/Log4perl/Logger.pm line 557 during global > >> destruction. > >> > > How can I avoid the internal error above? > Perhaps the uninitialized root logger causes the erroneous exception > handling as described in point 3.)? I'm not sure how you get there - is there an easy way for me to reproduce this problem? -- Mike Mike Schilli [EMAIL PROTECTED] - SF.Net email is sponsored by: The Future of Linux Business White Paper from Novell. From the desktop to the data center, Linux is going mainstream. Let it simplify your IT future. http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4 ___ log4perl-devel mailing list log4perl-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/log4perl-devel