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 Lu...@circuitcity.com on 2002/08/20 17:31:34 UTC

Example of variable substitution in an XML formatted config file

I am using the DOMConfigurator, and would like to make use of the variable
substitution available to Log4J.

Does anyone have an XML example of this?

The book only has a log4j.properties file example, and I do not know the
       XML syntax.  I get SAXParser errors...



Luc



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


RE: Example of variable substitution in an XML formatted config file

Posted by Thomas Muller <tt...@online.no>.
DOMConfigurator supports rudimentary variable interpolation. Variables found
in the System properties can be used in the XML config file like this:

<appender name="FOO" class="org.apache.log4j.DailyRollingFileAppender">
	<param name="file" value="${log.home}/foo.log" />
	<param name="append" value="true" />
	<param name="datePattern" value="'.'yyyy-MM-dd" />
	<param name="threshold" value="DEBUG" />
	<layout class="org.apache.log4j.PatternLayout">
		<param name="ConversionPattern" value="${log4j.appender.FOO.pattern}" />
	</layout>
</appender>

Hope this helps.

--

Thomas



| -----Original Message-----
| From: Luc_Bell@circuitcity.com [mailto:Luc_Bell@circuitcity.com]
| Sent: 20 August 2002 16:32
| To: Log4J Users List
| Subject: Example of variable substitution in an XML formatted config
| file
|
|
|
| I am using the DOMConfigurator, and would like to make use of the variable
| substitution available to Log4J.
|
| Does anyone have an XML example of this?
|
| The book only has a log4j.properties file example, and I do not know the
|        XML syntax.  I get SAXParser errors...
|
|
|
| Luc
|
|
|
| --
| To unsubscribe, e-mail:
| <ma...@jakarta.apache.org>
| For additional commands, e-mail:
<ma...@jakarta.apache.org>




*************************************************************************
Copyright ERA Technology Ltd. 2002. (www.era.co.uk). All rights reserved. 
The information supplied in this email should be treated in confidence.
No liability whatsoever is accepted for any loss or damage 
suffered as a result of accessing this message or any attachments.

________________________________________________________________________
This email has been scanned for all viruses by the MessageLabs SkyScan
service. For more information on a proactive anti-virus service working
around the clock, around the globe, visit http://www.messagelabs.com
________________________________________________________________________

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