Jake,

I see your point. Do you see anything wrong with the following?

void myInitialization() {
  // set the selector to MyRepositorySelector, preserving the
  // existing default repository:
  RepositorySelector mySelector = new MyRepositorySelector();
  // assume default selector is in currently in use
  LoggerRepository defaultRepository= LogManger.getLoggerRepository();
  mySelector.setDefaultRepository(defaultRepository);
  try {
    LogManger.setRepositorySelector(mySelector, new Object());
  } catch(IllegalArgumentException iae) {
     // the selector was already set
  }
  ...
}


At 05:20 PM 11/30/2004, Jacob Kjome wrote:

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

-- 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]



Reply via email to