You could use an XML internal entity for that:

<!DOCTYPE log4j:configuration [
<!ENTITY myvariable 'somevalue''>
]>
<log4j:configuration>
    <logger name="&myvariable;">
    </logger>
</log4:configuration>


See http://www.xml.com/pub/a/98/08/xmlqna2.html, the XML spec or any number of 
other resources.

On Dec 14, 2010, at 7:49 AM, stan.forums wrote:

> 
> Hi all,
> 
> I wish to declare a local variable inside my xml configuration file, and
> then later on i wish to access that variable. The reason being that i
> declare many appenders in one config file. When i wish to change the path to
> the log file in the appender, idon't want to have to edit each appender
> separately, i would like to have a declared logpath variable at the top of
> the config file and then just have to edit that one variable definition and
> then all of the appenders will have the correct new path automagically.
> 
> thanks
> -- 
> View this message in context: 
> http://old.nabble.com/Local-variable-in-XML-configuration-file-tp30454810p30454810.html
> Sent from the Log4cxx - Users mailing list archive at Nabble.com.
> 

Reply via email to