Quoting Ceki G�lc� <[EMAIL PROTECTED]>:

> At 08:16 AM 11/30/2004, Jacob Kjome wrote:
>
> >BTW, I figured out why I was getting all those null pointers.  My
> >initialization code calls LogManager.setRepositorySelector() to guarantee
> >that the ContextJNDISelector is used if it hasn't already been
> >installed.  The problem is, the defaultRepository field of this new
> >selector is null.  The old configured repository field contained in the
> >DefaultRepositorySelector needs to be transfered to the new repository.  I
> >now do this inside setRepositorySelector().  I will commit this when I can
> >tomorrow.  I have too much debugging code in there right now and I'm
> >already up way too late as it is.
>
> I am not sure I fully understand what you have in mind but I believe that
> current code in LogManager and ContextJNDISelector are correct, at least
> with respect to the setRepositorySelector() method. Note that the default
> repository returned by a given repository selector may be different than
> the default repository LogManager starts off with. Thus, I do not see a
> valid reason to change the LogManager.setRepositorySelector method, if that
> was what you had in mind.
>

Well, the way things currently stand, as soon as you switch the repository
selector to the new one via LogManager.setRepositorySelector(), the
defaultLoggerRepository is null and will always be null because it is not
initialized to anything but null.  As such, in the case of applications running
under Tomcat, any that don't define the log4j/context-name JNDI parameter will
get the default repository, which is null, therefore necessarily causing null
pointer exceptions in LogManager.getLogger().

My thought is to transfer the configured default repository from the original
selector to the new one being set.  That way, you don't lose the original
configuration and loggers using the default repository will continue as they
did before the switch of selectors.  I really think this is right and I am 100%
positive that there are problems with the current implementation.


Jake


> >Jake
>
> --
> Ceki G�lc�
>
>   The complete log4j manual:  http://qos.ch/eclm
>   Professional log4j support: http://qos.ch/log4jSupport
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to