You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avalon.apache.org by Mauro Talevi <ma...@aquilonia.org> on 2003/04/19 00:20:58 UTC
XMLConfigurator
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
Re: XMLConfigurator
Posted by Mauro Talevi <ma...@aquilonia.org>.
Leo Simons wrote:
> Mauro Talevi wrote:
>
>> wouldn't make sense to have an XMLConfigurator
>
>
> yep :D
>
>> Is there already something of this sort?
>
>
> commons-logging supports static-factory-style logkit use.
>
yes but we're back to the old static vs instance issue ...
the point I was making was that if one wants to encourage the use
of avalon logger (either with logkit/log4j or jdk14) outside a
container, it has make the configuration pretty straight forward.
Anyway, I attach a patch with the Configurator for excalibur-logger.
It contains a series of Logger configure(...) methods,
which may be reused in other contexts - eg Phoenix DefaultLogManager
(it effectively does the same thing as DefaultLogManager,
but it does not require any Phoenix libs).
Test case is also attached, passed against current cvs head.
Cheers, mauro
Re: XMLConfigurator
Posted by Leo Simons <le...@apache.org>.
Mauro Talevi wrote:
> wouldn't make sense to have an XMLConfigurator
yep :D
> Is there already something of this sort?
commons-logging supports static-factory-style logkit use.
cheers!
- Leo
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@avalon.apache.org
For additional commands, e-mail: dev-help@avalon.apache.org