I have a question on the log4j XML configuration. I want to have a HTMLLayout. But in the generated HTML file, there is no Line No. category. But I want to see it. I searched and it seems like to set LocationInfo to be true. But I don't know how to modify my XML.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd" >
<log4j:configuration>
<appender name="log" class="org.apache.log4j.FileAppender">
<param name="File" value= "log4j.html"/>
<param name="Append" value= "false" />
<layout class="org.apache.log4j.HTMLLayout"/>
</appender>
<appender name="stdout" class="org.apache.log4j.ConsoleAppender">
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d [%06r] [%F:%L] %-10c %x %m%n" />
</layout>
</appender>
<root>
<priority value="debug"/>
<appender-ref ref="log"/>
<!--appender-ref ref="stdout"/-->
</root>
</log4j:configuration>
In the javadoc 1 of
org.apache.log4j.HTMLLayout
states:So, you just need to set it to
true
. Therefore, the configuration of yourappender
could be similar to:Notes