logging-log4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jon Wilmoth <JWilm...@starbucks.com>
Subject Bug in getLogger(String, LoggerFactory)?
Date Wed, 29 May 2002 15:03:03 GMT
I'm using a custom LoggerFactory and not getting the expected behavior.
After taking a look at the source, the Hiearchy class's implementation of
getLogger(String, LoggerFactory) doesn't account for the LoggerFactory
producing logger's with different names.  The CategoryKey used to cache is
always the name of the string param and not the LoggerName.  Is this a bug?
I've attached a unit test which illustrate the problem.

 

Logger getLogger(String name, LoggerFactory factory) {

    //System.out.println("getInstance("+name+") called.");

    CategoryKey key = new CategoryKey(name);    

    // Synchronize to prevent write conflicts. Read conflicts (in

    // getChainedLevel method) are possible only if variable

    // assignments are non-atomic.

    Logger logger;

    

    synchronized(ht) {

      Object o = ht.get(key);

      if(o == null) {

            logger = factory.makeNewLoggerInstance(name);

...

}

 

Jon Wilmoth

Technical Specialist

Starbucks Coffee Company

 


Mime
View raw message