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

GelfLayout throws exception if some log event fields are null

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.3
    • Fix Version/s: 2.4
    • Component/s: Layouts
    • Labels:
      None

      Description

      When log message is null:

      2015-07-08 11:07:41,761 ERROR An exception occurred processing Appender Console java.lang.NullPointerException
      	at com.fasterxml.jackson.core.io.JsonStringEncoder.quoteAsString(JsonStringEncoder.java:106)
      	at org.apache.logging.log4j.core.layout.GelfLayout.toSerializable(GelfLayout.java:217)
      	at org.apache.logging.log4j.core.layout.GelfLayout.toByteArray(GelfLayout.java:184)
      	at org.apache.logging.log4j.core.appender.AbstractOutputStreamAppender.append(AbstractOutputStreamAppender.java:108)
      	at org.apache.logging.log4j.core.config.AppenderControl.callAppender(AppenderControl.java:99)
      	at org.apache.logging.log4j.core.config.LoggerConfig.callAppenders(LoggerConfig.java:430)
      	at org.apache.logging.log4j.core.config.LoggerConfig.log(LoggerConfig.java:409)
      	at org.apache.logging.log4j.core.config.LoggerConfig.log(LoggerConfig.java:367)
      	at org.apache.logging.log4j.core.Logger.logMessage(Logger.java:112)
      	at org.apache.logging.log4j.spi.AbstractLogger.logMessage(AbstractLogger.java:727)
      	at org.apache.logging.log4j.spi.AbstractLogger.logIfEnabled(AbstractLogger.java:716)
      

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              mikaelstaldal Mikael Ståldal
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: