Now to the Avalon Logging issue. Hm I am wondering why if ( this.getLogger().isDebugEnabled() ) was true, because I had no log-level configured as DEBUG. After a long time of debugging :-( I found two things.
1. org.apache.avalon.framework.logger.LogKit2AvalonLoggerAdapter In the method:
public static org.apache.log.Logger createLogger( final Logger logger ) { final Hierarchy hierarchy = new Hierarchy(); final org.apache.log.Logger logKitLogger = hierarchy.getLoggerFor( "" ); final LogKit2AvalonLoggerAdapter target = new LogKit2AvalonLoggerAdapter( logger ); logKitLogger.setLogTargets( new LogTarget[ ] { target } ); return logKitLogger; }
a logKitLogger is created with "hierarchy.getLoggerFor( "" )" this defaults the loglevel to DEBUG. The orig Logger is wrapped inside the LogTarget, so the result loglevel of the logger is allways DEBUG independant of the orig Logger setting.
that's not really what we want, is it? :D
I guess something like
if (!logger.isDebugEnabled()) {
if (!logger.isWarnEnabled()) {
if (!logger.isErrorEnabled()) {
logKitLogger.setPriority(Priority.FATAL_ERROR);
} else {
logKitLogger.setPriority(Priority.ERROR);
}
} else {
logKitLogger.setPriority(Priority.WARN);
}
}
can go into createLogger().
2. org.apache.avalon.excalibur.component.DefaultComponentFactory Method newInstance first checks if a Component implements "LogEnabled" and after this it checks for "Loggable". The problem is, if a Component impl. AbstractDualLogEnabled like ExcaliburComponentSelector the "setLogger" method of AbstractDualLogEnabled impl. overwrites the prev. set Logger with a wrapped LogKitLogger. Hm, I changed the order and put the check for "LogEnabled" after the "Loggable" and :-) the Logger isn't a wrapped LogKitLogger anymore.
Hmm. Why do we have a component that is both LogEnabled and Loggable? That seems to be, in general, a bad idea. I have always been under the impression that the two stages should be mutually exclusive.
cheers,
- Leo
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
