Uploaded image for project: 'Log4j 2'
  1. Log4j 2
  2. LOG4J2-933

HTML layout should not use attribute minimalization for hr noshade

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 2.0, 2.0.1, 2.1
    • 2.2
    • Layouts
    • None

    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

      Attachments

        Activity

          People

            Unassigned Unassigned
            ggregory Gary D. Gregory
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: