| <?xml version="1.0"?> |
| |
| <document> |
| |
| <properties> |
| <author email="ceki AT aappaacchheeee DOT org">Ceki Gulcu</author> |
| <title>Log4j error codes</title> |
| </properties> |
| |
| <body> |
| |
| <center> |
| <h2>Log4j error messages and their meanings</h2> |
| <h3>Ceki Gülcü <br/> |
| November 2004, last updated on December 17th, 2004</h3> |
| </center> |
| |
| <message ref="log4j_dtd"> |
| <title>The 'log4j.dtd' is no longer used nor needed.</title> |
| |
| <explanation> |
| <p>Given syntactical flexiblilty that |
| <code>JoranConfigrator</code> supports, it is no longer |
| possible to express this syntatical range with a DTD. Thus, |
| new log4j configuration files in XML should follow the general |
| template. |
| </p> |
| |
| <p class="red big">Good:</p> |
| |
| <pre><?xml version="1.0" encoding="UTF-8" ?> |
| <b><!DOCTYPE configuration></b> |
| |
| <configuration xmlns='http://logging.apache.org/'> |
| ... |
| </configuration> |
| </pre> |
| |
| <p>However, <code>JoranConfigurator</code> will continue to |
| parse your old XML configuration files which previously |
| required a reference to <code>log4j.dtd</code>. Thus, altough |
| deprecated, the following form will continue to be parsed |
| correctly. |
| </p> |
| |
| <p class="red big">Deprecated:</p> |
| |
| <pre><?xml version="1.0" encoding="UTF-8" ?> |
| <b><!DOCTYPE log4j:configuration SYSTEM "log4j.dtd"></b> |
| |
| <log4j:configuration xmlns:log4j='http://jakarta.apache.org/log4j/'> |
| ... |
| </log4j:configuration> |
| </pre> |
| |
| |
| <p>Using this deprecated form will generate the above mentioned |
| error message along with an error from the XML parser. |
| </p> |
| |
| </explanation> |
| </message> |
| |
| |
| <message ref="tbr_fnp_not_set"> |
| |
| <title>The <b>FileNamePattern</b> option must be set before |
| using <code>TimeBasedRollingPolicy</code> or |
| <code>FixedWindowRollingPolicy</code>. |
| </title> |
| |
| <explanation> |
| <p>The <b>FileNamePattern</b> option for both |
| <code>TimeBasedRollingPolicy</code> and |
| <code>FixedWindowRollingPolicy</code> is mandatory. |
| </p> |
| </explanation> |
| |
| </message> |
| |
| <message ref="appender_order"> |
| <title>Could not find an appender named [XYZ]. Did you define it below in the config file?</title> |
| |
| <explanation> |
| <p>Whereas the order of declatation of appenders did not |
| matter in log4j 1.2, in log4j version 1.3 and later, any |
| appender referenced at a given point must have been already |
| declared above that point. In practice though, only |
| configuration files declaring an <code>AsyncAppender</code> |
| may be affected by this change and only if the appenders |
| embeded in th <code>AsyncAppender</code> are declared below it |
| instead of being declared above it. |
| </p> |
| |
| <p>For example, the following config file will no longer work.</p> |
| |
| <p class="red big">Bad:</p> |
| |
| <pre class="source"><?xml version="1.0" encoding="UTF-8" ?> |
| <!DOCTYPE log4j:configuration> |
| |
| <log4j:configuration xmlns:log4j='http://jakarta.apache.org/log4j/'> |
| |
| <appender name="<b class="red">ASYNC</b>" class="org.apache.log4j.AsyncAppender"> |
| <appender-ref ref="FILE" /> |
| </appender> |
| |
| <appender name="<b>FILE</b>" class="org.apache.log4j.FileAppender"> |
| <param name="File" value="myapp.log"/> |
| ... |
| </appender> |
| |
| <root> |
| <level value ="debug" /> |
| <appender-ref ref="ASYNC" /> |
| </root> |
| |
| </log4j:configuration> |
| </pre> |
| |
| <p>It should be changed to the following form.</p> |
| |
| <p class="red big">Good:</p> |
| |
| <pre class="source"><?xml version="1.0" encoding="UTF-8" ?> |
| <!DOCTYPE configuration> |
| |
| <configuration xmlns='http://logging.apache.org/'> |
| |
| <appender name="<b class="red">FILE</b>" class="org.apache.log4j.FileAppender"> |
| <param name="File" value="myapp.log"/> |
| ... |
| </appender> |
| |
| <appender name="<b>ASYNC</b>" class="org.apache.log4j.AsyncAppender"> |
| <appender-ref ref="FILE" /> |
| </appender> |
| |
| <root> |
| <level value ="debug" /> |
| <appender-ref ref="ASYNC" /> |
| </root> |
| </configuration> |
| </pre> |
| |
| |
| </explanation> |
| |
| </message> |
| </body> |
| </document> |