On Tue, 16 Nov 2010, Tom Metro wrote:

> 1. Ability to create a library module that can use Log4perl, such that
> if the calling code makes no use of Log4perl, it logs independently
> with locally specified defaults, but if the caller does use Log4perl,
> it picks up the callers settings.
Hi Tom,

the current Log4perl implementation assumes that the calling script
initializes Log4perl and libraries don't. Libraries make use of
Log4perl by issuing log statements, but they don't try to modify the
inititalization. If Log4perl isn't initialized in the main program, all
is quiet.

> The trigger for the problem turned out to be a 'use' call in the eval'ed
> code that loaded a library which internally called easy_init() (yet
> specifying the INFO logging level).

That's very confusing and should be avoided at all cost.

> This seems broken that a library using normal Log4perl methods can trash
> the logger in use by the calling code.

That library wasn't using 'normal Log4perl methods', but was clobbering
the settings. We discourage people from doing that, although we don't
stop anyone shooting themselves in the foot (or putting up a module on
CPAN that shoots everyone in the foot for that matter).

But you're bringing up an interesting topic: What would be a good
approach to allow a library to meddle with Log4perl's settings, in the
absence or even presence of a previous initialization?

Everything I've seen so far is just plain confusing to the end user. I'm
open to ideas, however.


-- Mike

Mike Schilli
m...@perlmeister.com

------------------------------------------------------------------------------
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
Spend less time writing and  rewriting code and more time creating great
experiences on the web. Be a part of the beta today
http://p.sf.net/sfu/msIE9-sfdev2dev
_______________________________________________
log4perl-devel mailing list
log4perl-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/log4perl-devel

Reply via email to