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 Josh Kleinpeter <kl...@corp.earthlink.net> on 2002/12/20 02:53:39 UTC

XML Configuration and Default variables

I've been using Log4j for a while now, and I'm looking in to going from 
the properties file format to the XML format.  However, I can't figure 
out how to define defaults for my variables within my XML files.

example:

<appender name="LOGFILE" 		
	class="org.apache.log4j.DailyRollingFileAppender">
	<param name="DatePattern" value=".yyyy-MM-dd"/>
	<param name="File" value="${log.dir}/log4j.log"/>
	<layout class="org.apache.log4j.PatternLayout">
		<param name="ConversionPattern" value="${pattern}"/>
	</layout>
</appender>

How can I pre define my log.dir variable so that it will not send the 
log4j.log file to the root directory if I do not pass in a -D parameter? 
  Likewise, I would really like to be able to define conversion patterns 
and use them multiple times instead of having to duplicate that pattern.

With the properties file, I would simply have:

log.dir=/tmp
pattern=%m%n

at the start of my config file.  I have yet to see such a facility with 
the XML file.

Thanks for any help.

josh


-- 
josh kleinpeter    | sr software engineer
web infrastructure | earthlink.net

Superior intelligence and senseless cruelty just do not go together.
   -- Dr. Who


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>