xml - Single definition of value used multiple times in log4cxx configuration -


i have log4cxx.xml configuration file defines multiple rolling file appenders.

<?xml version="1.0" encoding="utf-8" ?> <log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false">   <appender name="a" class="org.apache.log4j.rolling.rollingfileappender">     <param name="file" value="file1.log" />     <param name="maxfilesize" value="12mb" />     ...   </appender>   ...   <appender name="g" class="org.apache.log4j.rolling.rollingfileappender">     <param name="file" value="file7.log" />     <param name="maxfilesize" value="12mb" />     ...   </appender>   <!-- loggers referencing a, b, ..., g --> 

i have 1 place, in file, define maximum file size. know can replace 12mb ${max_file_size} , value environment, not want have set environment variable.

it seemed following should work.

<?xml version="1.0" encoding="utf-8" ?> <!doctype log4j:configuration  [ <!entity maxfilesize "12mb"> ]> <log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false">   <appender name="a" class="org.apache.log4j.rolling.rollingfileappender">     <param name="file" value="file1.log" />     <param name="maxfilesize" value="&maxfilesize" />     ...   </appender>   ... 

however, fails log4cxx: error parsing file [log4cxx.xml], internal errorxml parser error code: not well-formed (invalid token) (4).

my guess going wrong either got doctype statement wrong, or log4cxx not have full xml parser , not expect doctype. have little experience dtds, both answers plausible me.

is there way fix doctype make work, or different method desired result of specifying maximum file size @ 1 location in file?

it looks missed semicolon in entity reference.

it should this:

<param name="maxfilesize" value="&maxfilesize;" /> 

the doctype declaration looks fine.


Comments

Popular posts from this blog

javascript - how to protect a flash video from refresh? -

android - Associate same looper with different threads -

visual studio 2010 - Connect to informix database windows form application -