Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
2.0, 2.0.1, 2.1
-
None
-
Apache Maven 3.2.5 (12a6b3acb947671f09b81f49094c53f426d8cea1; 2014-12-14T12:29:23-05:00)
Maven home: C:\Java\apache-maven-3.2.5
Java version: 1.7.0_71, vendor: Oracle Corporation
Java home: C:\Program Files\Java\jdk1.7.0_71\jre
Default locale: en_US, platform encoding: Cp1252
OS name: "windows 7", version: "6.1", arch: "amd64", family: "windows"Apache Maven 3.2.5 (12a6b3acb947671f09b81f49094c53f426d8cea1; 2014-12-14T12:29:23-05:00) Maven home: C:\Java\apache-maven-3.2.5 Java version: 1.7.0_71, vendor: Oracle Corporation Java home: C:\Program Files\Java\jdk1.7.0_71\jre Default locale: en_US, platform encoding: Cp1252 OS name: "windows 7", version: "6.1", arch: "amd64", family: "windows"
Description
From the ML:
---------- Forwarded message ----------
From: ppiman <ppiman@gmail.com>
Date: Thu, Jan 8, 2015 at 12:02 AM
Subject: Log4j2 - Custom HTML Layout footer not getting called to end the log file
To: log4j-user@logging.apache.org
Hello,
I've run into a problem that I just can't figure out and I'm hoping you
will be able to help me.
My goal is to have log4j keep adding to the log file and at some point be
able called the log url address and my app display the log file on the fly
with out stopping the app or undeploying it.
So here goes:
I'm trying to do a log file for a web app. My app is JSF 2 (xhtml). I've
got my custom HTML Layout that I extend from AbstractStringLayout. (Reason
I made custom HTML Layout was with XHTML this line in the log4j HTMLLayout
was throwing an error: sbuf.append("<hr size=\"1\" noshade">") and XHTML
wants an <hr size=\"1\" noshade=\"noshade\">)
Now when I run my app, the log is generated and everthing is working except
the getFooter() method never gets called to finish the table and file.
Which when I call the URL to the log file I get a error saying the document
structure is not complete.
log4j2.xml file:
<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="INFO" packages="com.qualcomm.asictracker.util">
<Properties>
<Property name="log-path">${web:rootDir}/WEB-INF/logs</Property>
</Properties>
<Appenders>
<File name="HTMLAppender" fileName="${log-path}/asictracker.html"
append="true" immediateFlush="true">
<MyHtmlLayout locationInfo="true" charset="UTF-8" title="ASIC
Tracker Logs"></MyHtmlLayout>
</File>
</Appenders>
<Loggers>
<Root level="debug" >
<AppenderRef ref="HTMLAppender"/>
</Root>
</Loggers>
</Configuration>
I'm using a blank XHTML file that has a ui:include to include my html log4j
output.
Jar's Using:
log4j-api-2.1.jar
log4j-core-2.1.jar
log4j-web-2.1.jar
Sorry for the long email. Trying to give you as much details as possible.
Thanks for the help.
-Dale