[ https://issues.apache.org/jira/browse/LOG4J2-1527?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15425176#comment-15425176 ]
ASF GitHub Bot commented on LOG4J2-1527: ---------------------------------------- GitHub user leonj1 opened a pull request: https://github.com/apache/logging-log4j2/pull/39 LOG4J2-1527 - Add a null check in getFormattedMessage and initialize when needed One way to see this problem is by changing "GcFreeLoggingTestUtil.executeLogging()" from: System.setProperty("log4j2.is.webapp", "false"); to: System.setProperty("log4j2.is.webapp", "true"); You can merge this pull request into a Git repository by running: $ git pull https://github.com/leonj1/logging-log4j2 bugfix_prevent_npe_on_getFormattedMessage Alternatively you can review and apply these changes as the patch at: https://github.com/apache/logging-log4j2/pull/39.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #39 ---- commit c5430dbb2c14cf8753439cf331991187ce4d164d Author: Jose Leon <jleo...@bloomberg.net> Date: 2016-08-17T18:54:43Z LOG4J2-1527 - Add a null check in getFormattedMessage and initialize when needed ---- > NPE thrown when log4j2 used within a webapp and RingBufferLogEvent's > getFormattedMessage() is called. > ----------------------------------------------------------------------------------------------------- > > Key: LOG4J2-1527 > URL: https://issues.apache.org/jira/browse/LOG4J2-1527 > Project: Log4j 2 > Issue Type: Bug > Affects Versions: 2.6.2 > Reporter: Jose Leon > > This happens because 'messageText' is never initialized, therefore "return > messageText.toString();" throws the NPE. -- This message was sent by Atlassian JIRA (v6.3.4#6332) --------------------------------------------------------------------- To unsubscribe, e-mail: log4j-dev-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-dev-h...@logging.apache.org