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

JSON output wrong when using additonal fields

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 2.12.0
    • Fix Version/s: None
    • Component/s: Layouts
    • Labels:
      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

              • Assignee:
                Unassigned
                Reporter:
                awi4711 Andreas Winter
              • Votes:
                6 Vote for this issue
                Watchers:
                7 Start watching this issue

                Dates

                • Created:
                  Updated:

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 0.5h
                  0.5h