You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by Dirk Ooms <di...@onesparrow.com> on 2005/12/12 10:25:07 UTC

log4j.xml validation

Hi,

i am a bit puzzled on how i should do an apriori validation of a log4j.xml in 
log4j1.3 (without applying it to a LoggerRepository).

can I still use the .dtd? but I am wondering whether the .dtd is still in sync 
with what is happening in the JoranConfigurator, e.g. if i remember well the 
.dtd still contains <log4j:configuration>, while the JoranConfigurator only 
accepts <configuration>.

or should i use a temporary LoggerRepository, apply a configuration with the 
JoranConfigurator to it and check whether it returns any errors?

cheers,
dirk 

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org


Re: log4j.xml validation

Posted by Curt Arnold <ca...@apache.org>.
Dirk Ooms wrote:

>Hi,
>
>i am a bit puzzled on how i should do an apriori validation of a log4j.xml in 
>log4j1.3 (without applying it to a LoggerRepository).
>  
>

The XML format used by log4j was not designed so that it can be 
effectively validated using standard XML validation technologies.  It 
has been on my to-do list to attempt to design a modern XML 
configuration syntax with accompanying schema as at least a thought 
exercise.

The essential problem with the current design is that XML validation 
technologies rarely support the value space of one attribute based on 
the value of another.  So while:

<appender class="org.apache.log4j.FileAppender">
<attribute name="file" value="foo.log"/>
</appender>

and

<FileAppender file="foo.log" xmlns="http://logging.apache.org"/>

have the same information content, but an XML schema can readily be 
written so that the file name is checked against a regular expression 
with the second form, but not the first.

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org