On Aug 8, 2007, at 4:03 AM, Karan Malhi wrote:

I have added documentationi to use LogCategory createChild()
method sparingly as this could again cause anyone to create a logger
like

Logger logger = Logger.getInstance
(LogCategory.OPENEJB,"org.apache.openejb");
Logger logger2 = logger.getInstance("someChild");

Actually, I was thinking the following for this:
1. Change the visibility of LogCategory.createChild to package Level ,
this will ensure that LogCategory is immutable outside the o.a.o.util
package.
2. Users would be forced to use Logger class' getLogger(String child)
to obtain a "derived Logger"
3. Log the getLogger(String child) method itself and store the log
messages in a logger.logs file or a .logs file (which would be
hidden). Thus we could log each such logger which was a derived Logger
(dynamically created instead of using the LogCategory enum). The
benefit would be that we have a record of all the derived loggers in a
file , which will help us troubleshoot for any logging issues . This
.logs file is the "actual diff" (the "diff" utitlity I was talking
about) . Here is what could be added to the getLogger(String child)
method

public Logger getLogger(String child){
     Logger child = // create child logger here;
this.debug("Created Logger "+ child.logCategory.getName(), this.baseName);
}

Sounds great to me!

-David

Reply via email to