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

XMLLayout indents, but not the first child tag (<Event>)

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 2.5
    • 2.6
    • Layouts
    • None

    Description

      I am using log4j 2.5 to print the logs via XMLLayout. I have set compact="true", hence the new line and indents of sub tags work correctly. However I have noticed that the first child tag is not indented correctly.

      Following is such a sample where <Events> and <Event> are at the same indent level (0 indent).

      <?xml version="1.0" encoding="UTF-8"?>
      <Events xmlns="http://logging.apache.org/log4j/2.0/events">
      <Event xmlns="http://logging.apache.org/log4j/2.0/events" timeMillis="1460974404123" thread="main" level="INFO" loggerName="com.foo.Bar" endOfBatch="true" loggerFqcn="org.apache.logging.log4j.spi.AbstractLogger" threadId="11" threadPriority="5">
        <Message>First Msg tag must be in level 2 after correct indentation</Message>
      </Event>
      
      <Event xmlns="http://logging.apache.org/log4j/2.0/events" timeMillis="1460974404133" thread="main" level="INFO" loggerName="com.foo.Bar" endOfBatch="true" loggerFqcn="org.apache.logging.log4j.spi.AbstractLogger" threadId="11" threadPriority="5">
        <Message>Second Msg tag must also be in level 2 after correct indentation</Message>
      </Event>
      
      </Events>
      

      Attachments

        1. LOG4J2-1372_01.patch
          10 kB
          Kamal Mettananda

        Activity

          People

            ggregory Gary D. Gregory
            lkamal Kamal Mettananda
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: