logging-log4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mikael Ståldal (JIRA) <j...@apache.org>
Subject [jira] [Commented] (LOG4J2-1078) GelfLayout throws exception if some log event fields are null
Date Wed, 08 Jul 2015 12:43:04 GMT

    [ https://issues.apache.org/jira/browse/LOG4J2-1078?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14618521#comment-14618521
] 

Mikael Ståldal commented on LOG4J2-1078:
----------------------------------------

Shouldn't we set the message to "null" (rather than the empty string) if it's null? That's
how PatternLayout works.

> GelfLayout throws exception if some log event fields are null
> -------------------------------------------------------------
>
>                 Key: LOG4J2-1078
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-1078
>             Project: Log4j 2
>          Issue Type: Bug
>          Components: Layouts
>    Affects Versions: 2.3
>            Reporter: Mikael Ståldal
>             Fix For: 2.4
>
>
> When log message is null:
> {code}
> 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)
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org


Mime
View raw message