Hi,

another question came up while working on Avalon support in Turbine:

In the current Turbine code, we use constructs like this:

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

public class Foo
{
    private static Log log = LogFactory.getLog(Foo.class);
[...]
}

to acquire loggers for the various classes. This allows the user to
control exactly which classes or packages he wants to see on which
debug level (ATM we support only Log4j with the commons-logging
package).

In Avalon, the logger is set by the managing component, so in the end,
our AvalonComponentService must pass a Logger object as the "root" logger
to the Component Manager for logging purposes.

ATM we simply set up a new Logging category called "avalon" and pass a
logging object to the Manager:

LoggerManager lm = new Log4JLoggerManager();
Logger logger = lm.getLoggerForCategory(AVALON_LOG_CATEGORY);

DefaultRoleManager roles = new DefaultRoleManager();
roles.enableLogging(logger);

ExcaliburComponentManager manager = new ExcaliburComponentManager();
manager.setLoggerManager(lm);
manager.enableLogging(logger);


But now all the messages from the avalon components end up in a single
logging category, called "avalon":

2003-06-22 18:25:41,577 [HttpProcessor[8080][4]] DEBUG avalon - added Role 
org.apache.torque.avalon.Torque with shorthand torque for 
org.apache.torque.avalon.TorqueComponent
2003-06-22 18:25:41,708 [HttpProcessor[8080][4]] DEBUG avalon - looking up shorthand 
torque, returning org.apache.torque.avalon.Torque
2003-06-22 18:25:41,708 [HttpProcessor[8080][4]] DEBUG avalon - Adding component 
(org.apache.torque.avalon.Torque = org.apache.torque.avalon.TorqueComponent)
2003-06-22 18:25:41,720 [HttpProcessor[8080][4]] DEBUG avalon - Attempting to get 
Handler for role [org.apache.torque.avalon.Torque]
2003-06-22 18:25:41,811 [HttpProcessor[8080][4]] DEBUG avalon - Handler type = 
org.apache.avalon.excalibur.component.DefaultComponentHandler
2003-06-22 18:25:41,925 [HttpProcessor[8080][4]] DEBUG avalon - ComponentHandler 
initialized for: org.apache.torque.avalon.TorqueComponent
2003-06-22 18:25:41,946 [HttpProcessor[8080][4]] DEBUG avalon - ComponentFactory 
creating new instance of org.apache.torque.avalon.TorqueComponent.
[...]

Is it possible to tell the avalon components that they should use a
logging category based on their class name just as we do with
commons-logging?

        Regards
                Henning




-- 
Dipl.-Inf. (Univ.) Henning P. Schmiedehausen          INTERMETA GmbH
[EMAIL PROTECTED]        +49 9131 50 654 0   http://www.intermeta.de/

Java, perl, Solaris, Linux, xSP Consulting, Web Services 
freelance consultant -- Jakarta Turbine Development  -- hero for hire

--- Quote of the week: "Never argue with an idiot. They drag you down
to their level, then beat you with experience." ---


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

Reply via email to