commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Scott Sanders" <ssand...@nextance.com>
Subject RE: [joran] example (was Re: [Latka][Proposal] Make Jelly a required dependency?)
Date Mon, 14 Oct 2002 20:48:22 GMT
> Property 0 says that parsing of appender tags are driven by 
> logger tags. For example, the following config script does nothing.

OK, I think I understand now.

> <?xml version="1.0" encoding="UTF-8" ?>
> <!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
> 
> <log4j:configuration xmlns:log4j='http://jakarta.apache.org/log4j/'>
> 
>    <appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
>      <param name="Threshold" value="INFO"/>
>      <layout class="org.apache.log4j.PatternLayout">
>        <param name="ConversionPattern" value="%-5p [%t] %c - %m%n"/>
>      </layout>
>    </appender>
> </log4j:configuration>
> 
> In particular, the CONSOLE appender is not created because no 
> logger references it.

Gotcha.

> Property 0 requires the XML processor to access elements that 
> have been already defined. With Digester which is SAX based, 
> there is no way for a rule to trigger parsing of an element 
> that was already parsed by the SAX parser. In other words, 
> using SAX you cannot access elements backwards or forwards. 
> You only have access to the current element.  Please correct 
> me if I am wrong.

You are not wrong, the only way to do this would be to force loggers to
come first, or build everything and then throw it away if you don't need
it.  Another way would be to cache the elements and then refire them if
you find a logger that needs them.

Is there anyway to create and throw away an appender?  Or to require
that loggers come first?  The other way would be to cache the appender
nodes somehow in a custom rule, that is then accessible when the time
comes to need to load it.

Am I making sense now?

So, the default Digester setup cannot do this, unless you are willing to
construct and then throwaway unnecessary objects.

Cheers,
Scott

--
To unsubscribe, e-mail:   <mailto:commons-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>


Mime
View raw message