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

JSON output wrong when using additonal fields

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 2.12.0
    • 2.13.1
    • Layouts
    • None

    Description

      When using additional fields in the JsonLayout the output is something like

      {"logEvent":"File not found","source":"BIG","timestamp":"07-09-2019"}

      instead of the full JSON string as of version 2.10 (where everything works as expected).

      Config used:

       

      <?xml version="1.0" encoding="UTF-8"?>
       <Configuration>
         <Appenders>
           <Console name="CONSOLE">
             <JsonLayout complete="false" compact="true" eventEol="true" stacktraceAsString="true">
               <KeyValuePair key="source" value="BIG"/>
               <KeyValuePair key="timestamp" value="$${date:MM-dd-yyyy}"/>
             </JsonLayout>
            </Console>
          </Appenders>
         <Loggers>
            <Root level="info">
              <AppenderRef ref="CONSOLE"/>
            </Root>
          </Loggers>
       </Configuration>
      

       

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              awi4711 Andreas Winter
              Votes:
              8 Vote for this issue
              Watchers:
              10 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 1h 20m
                  1h 20m