avalon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mauro Talevi <mauro.tal...@aquilonia.org>
Subject XMLConfigurator
Date Fri, 18 Apr 2003 22:20:58 GMT
Hi,

when using the avalon logger outside of a container - eg in a webapp,
the configuration of logkit it is not trivial - especially if someone is 
not too familiar
with the entire avalon framework.
What it requires is something along the lines of (similarly to what 
phoenix DefaultLogManager does)

LoggerManager loggerManager = new LogKitLoggerManager();
DefaultConfigurationBuilder builder = new DefaultConfigurationBuilder();
Configuration configuration = builder.build(
	new FileInputStream("logkit.xml"));
ContainerUtil.contextualize( loggerManager,  new DefaultContext());
ContainerUtil.configure( loggerManager, configuration );
Logger logger = loggerManager.getDefaultLogger();

Now this is clearly more complex than the log4j

DOMConfigurator.configure("log4j.xml");

Barring the fact the the configurator is static and in COP this is 
kind-of-evil,
wouldn't make sense to have an XMLConfigurator  with a method to return 
an avalon Logger from a configure(String filename) method, eg

XMLConfigurator configurator =  new  XMLConfigurator();
Logger logger = configurator.configure("logkit.xml);

which could then be passed to logEnabled component or stored in some 
context for use upon request.

Is there already something of this sort?
If not, it would make it easier for people to adopt the avalon logger 
outside of an avalon container

Cheers, Mauro




---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@avalon.apache.org
For additional commands, e-mail: dev-help@avalon.apache.org


Mime
View raw message