Re: [log4perl-devel] Problems with uninitialized root-logger in log::log4perl

2007-12-04 Thread Mike Schilli
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


Re: [log4perl-devel] Log::Log4Perl::Util::module_available broken...

2007-12-04 Thread Merijn Broeren
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