logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jacob Kjome <h...@visi.com>
Subject Re: Setting properties for log4j.xml configuration file
Date Tue, 22 Feb 2011 02:05:17 GMT

Curt,

Maybe I'm missing something, but how does using XML entity refs do anything for
referencing Java system properties?  The simple answer is that Log4j XML config
files support exactly the same syntax as properties files, e.g.,....

    	<param name="File" value="${log4j.logdir}/MyAppender1.log"/>

I don't recall whether/where it's specifically documented or not, but it works.


Jake

On 2/20/2011 10:30 PM, Curt Arnold wrote:
> XML entity references can be used for that purpose and are defined in the XML Recommendation
(http://www.w3.org/TR/xml/#sec-references).
> 
> <!DOCTYPE log4j:configuration
> [
> <!ENTITY logdir "c:/data/logfiles">
> ]>
> <log4j:configuration>
> ...
> <param name="file" value="&logdir;"/>
> ...
> </log4j:configuration>
> 
> On Feb 20, 2011, at 6:35 AM, Thomas Wiedmann wrote:
> 
>> Hello,
>>
>> usually in flat plain text log4j.config files global system properties can be defined,
which may be referenced in the configuration of different appenders, e. g.
>>
>> log4j.logdir=C:/Data/logfiles
>> ...
>> log4j.appender.MyAppender1.File=${log4j.logdir}/MyAppender1.log
>> ...
>> log4j.appender.MyAppender2.File=${log4j.logdir}/MyAppender2.log
>>
>> I found this is a very convenient way to define (and to administer) such parameters
only once globally for the entire log configuration and to use it on several references as
here in the appenders configuration.
>>
>> How can such global system properties be defined in xml-based configuration files
(log4j.xml)?
>> Where is it documented? I'd found no hint about it.
>>
>> Thomas Wiedmann 
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
>> For additional commands, e-mail: log4j-user-help@logging.apache.org
>>
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
> 
> 
> 
> 

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


Mime
View raw message