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

        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.

          People

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

            Dates

            • Created:
              Updated:
              Resolved:

              Development