Log4j 2
  1. Log4j 2
  2. LOG4J2-478

The message and ndc fields are not JavaScript escaped in JSONLayout

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.0-beta9
    • Fix Version/s: 2.0-rc1
    • Component/s: Layouts
    • Labels:
      None

      Description

      The output of the JSONLayout includes the "message" field as is. If there are any embedded newlines, quote, etc, this renders the JSON output as invalid. To correct this, the "message" field should be properly JavaScript escaped.

        Activity

        Michael Friedmann created issue -
        Gary Gregory made changes -
        Field Original Value New Value
        Assignee Gary Gregory [ garydgregory ]
        Gary Gregory made changes -
        Summary "message" field not JavaScript escaped in JSONLayout "message" and "ndc" fields are not JavaScript escaped in JSONLayout
        Gary Gregory made changes -
        Summary "message" and "ndc" fields are not JavaScript escaped in JSONLayout The message and ndc fields are not JavaScript escaped in JSONLayout
        Hide
        Gary Gregory added a comment -
        commit -m "[LOG4J2-478] The message and ndc fields are not JavaScript escaped in JSONLayout." C:/vcs/svn/apache/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/layout/JSONLayout.java C:/vcs/svn/apache/log4j2/trunk/src/changes/changes.xml C:/vcs/svn/apache/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/helpers/Transform.java C:/vcs/svn/apache/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/layout/JSONLayoutTest.java
            Sending        C:/vcs/svn/apache/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/helpers/Transform.java
            Sending        C:/vcs/svn/apache/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/layout/JSONLayout.java
            Sending        C:/vcs/svn/apache/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/layout/JSONLayoutTest.java
            Sending        C:/vcs/svn/apache/log4j2/trunk/src/changes/changes.xml
            Transmitting file data ...
            Committed revision 1553750.
        
        Show
        Gary Gregory added a comment - commit -m "[LOG4J2-478] The message and ndc fields are not JavaScript escaped in JSONLayout." C:/vcs/svn/apache/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/layout/JSONLayout.java C:/vcs/svn/apache/log4j2/trunk/src/changes/changes.xml C:/vcs/svn/apache/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/helpers/Transform.java C:/vcs/svn/apache/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/layout/JSONLayoutTest.java Sending C:/vcs/svn/apache/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/helpers/Transform.java Sending C:/vcs/svn/apache/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/layout/JSONLayout.java Sending C:/vcs/svn/apache/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/layout/JSONLayoutTest.java Sending C:/vcs/svn/apache/log4j2/trunk/src/changes/changes.xml Transmitting file data ... Committed revision 1553750.
        Gary Gregory made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        Transition Time In Source Status Execution Times Last Executer Last Execution Date
        Open Open Resolved Resolved
        5h 12m 1 Gary Gregory 27/Dec/13 22:13

          People

          • Assignee:
            Gary Gregory
            Reporter:
            Michael Friedmann
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development