Hi Gary,
org.apache.logging.log4j.core.layout.HtmlLayout.getHeader()
writes more header bytes before it gets to:

<body bgcolor="#FFFFFF" topmargin="6" leftmargin="6">
Looking at the code I do not see how an HTML file written by Log4j 2.7 can start with a body tag.

Can you verify that only Log4j 2.7 is on the classpath?


All *log* related jars under WEB-INF/lib used to be:

commons-logging-1.2.jar
log4j-1.2-api-2.3.jar
log4j-api-2.3.jar
log4j-core-2.3.jar
log4j-jcl-2.3.jar
log4j-web-2.3.jar




(1) Install new jars, WEB-INF/lib now shows:
commons-logging-1.2.jar
log4j-1.2-api-2.7.jar
log4j-api-2.7.jar
log4j-core-2.7.jar
log4j-jcl-2.7.jar
log4j-web-2.7.jar



(2) start tomcat7;  log user login;

     debug.html displays correctly as shown below:


<html>
<head>
<meta charset="UTF-8"/>
</head>
<body bgcolor="#FFFFFF" topmargin="6" leftmargin="6">
<hr size="1" noshade="noshade">
Log session start time Tue Oct 11 12:26:50 EDT 2016<br>
<br>
<table cellspacing="0" cellpadding="4" border="1" bordercolor="#224466" width="100%">
<tr>
<th>Time</th>
<th>Thread</th>
<th>Level</th>
<th>Logger</th>
<th>Message</th>
</tr>

<tr>
<td>30382</td>
<td title="http-bio-8080-exec-9 thread">http-bio-8080-exec-9</td>
<td title="Level"><font color="#339933">DEBUG</font></td>
<td title="ProcessLogin logger">ProcessLogin</td>
<td title="Message">2016-10-11 12:27:12 login successfully</td>
</tr>




(3) http://hostname:8080/manager/html
      Click button "Reload"



(4) login again

debug.html shows wrong format. "<td>237137</td>" is not shown under table anymore.

    Here is the html contents:

<html>
<head>
<meta charset="UTF-8"/>
<title>login_out_info</title>
<style type="text/css">
</style>
</head>
<body bgcolor="#FFFFFF" topmargin="6" leftmargin="6">
<hr size="1" noshade="noshade">
Log session start time Tue Oct 11 12:26:50 EDT 2016<br>
<br>
<table cellspacing="0" cellpadding="4" border="1" bordercolor="#224466" width="100%">
<tr>
<th>Time</th>
<th>Thread</th>
<th>Level</th>
<th>Logger</th>
<th>Message</th>
</tr>

<tr>
<td>30382</td>
<td title="http-bio-8080-exec-9 thread">http-bio-8080-exec-9</td>
<td title="Level"><font color="#339933">DEBUG</font></td>
<td title="ProcessLogin logger">ProcessLogin</td>
<td title="Message">2016-10-11 12:27:12 login successfully</td>
</tr>

</table>
<br>
</body></html>

<tr>
<td>237137</td>
<td title="http-bio-8080-exec-2 thread">http-bio-8080-exec-2</td>
<td title="Level"><font color="#339933">DEBUG</font></td>
<td title="ProcessLogin logger">ProcessLogin</td>
<td title="Message">2016-10-11 12:30:39 login successfully</td>
</tr>

==================================================

"</table><br></body></html>" is added, but there is no <table> for <TR><TD>237137....

Any help?

Thanks a lot!

Reply via email to