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

NullPointerException in HtmlLayout

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 2.8
    • 2.8.2
    • Layouts
    • None

    Description

      Got following NullPointerException by using SMTP appender.

      AsyncLogger error handling event seq=233, value='[ERROR calling class org.apache.logging.log4j.core.async.RingBufferLogEvent.toString(): java.lang.NullPointerException]':
      org.apache.logging.log4j.core.appender.AppenderLoggingException: An exception occurred processing Appender Mail
      	at org.apache.logging.log4j.core.appender.DefaultErrorHandler.error(DefaultErrorHandler.java:75)
      	at org.apache.logging.log4j.core.config.AppenderControl.handleAppenderError(AppenderControl.java:165)
      	at org.apache.logging.log4j.core.config.AppenderControl.tryCallAppender(AppenderControl.java:158)
      	at org.apache.logging.log4j.core.config.AppenderControl.callAppender0(AppenderControl.java:129)
      	at org.apache.logging.log4j.core.config.AppenderControl.callAppenderPreventRecursion(AppenderControl.java:120)
      	at org.apache.logging.log4j.core.config.AppenderControl.callAppender(AppenderControl.java:84)
      	at org.apache.logging.log4j.core.config.LoggerConfig.callAppenders(LoggerConfig.java:448)
      	at org.apache.logging.log4j.core.config.LoggerConfig.processLogEvent(LoggerConfig.java:433)
      	at org.apache.logging.log4j.core.config.LoggerConfig.log(LoggerConfig.java:417)
      	at org.apache.logging.log4j.core.config.AwaitCompletionReliabilityStrategy.log(AwaitCompletionReliabilityStrategy.java:79)
      	at org.apache.logging.log4j.core.async.AsyncLogger.actualAsyncLog(AsyncLogger.java:337)
      	at org.apache.logging.log4j.core.async.RingBufferLogEvent.execute(RingBufferLogEvent.java:156)
      	at org.apache.logging.log4j.core.async.RingBufferLogEventHandler.onEvent(RingBufferLogEventHandler.java:45)
      	at org.apache.logging.log4j.core.async.RingBufferLogEventHandler.onEvent(RingBufferLogEventHandler.java:29)
      	at com.lmax.disruptor.BatchEventProcessor.run(BatchEventProcessor.java:129)
      	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
      	at java.lang.Thread.run(Thread.java:745)
      Caused by: org.apache.logging.log4j.LoggingException: Error occurred while sending email
      	at org.apache.logging.log4j.core.net.SmtpManager.sendEvents(SmtpManager.java:175)
      	at org.apache.logging.log4j.core.appender.SmtpAppender.append(SmtpAppender.java:181)
      	at org.apache.logging.log4j.core.config.AppenderControl.tryCallAppender(AppenderControl.java:156)
      	... 15 more
      Caused by: java.lang.NullPointerException
      	at org.apache.logging.log4j.core.layout.HtmlLayout.toSerializable(HtmlLayout.java:170)
      	at org.apache.logging.log4j.core.layout.HtmlLayout.toSerializable(HtmlLayout.java:50)
      	at org.apache.logging.log4j.core.layout.AbstractStringLayout.toByteArray(AbstractStringLayout.java:301)
      	at org.apache.logging.log4j.core.net.SmtpManager.writeBuffer(SmtpManager.java:204)
      	at org.apache.logging.log4j.core.net.SmtpManager.writeContent(SmtpManager.java:190)
      	at org.apache.logging.log4j.core.net.SmtpManager.formatContentToBytes(SmtpManager.java:182)
      	at org.apache.logging.log4j.core.net.SmtpManager.sendEvents(SmtpManager.java:163)
      	... 17 more
      

      Attachments

        Issue Links

          Activity

            People

              ggregory Gary D. Gregory
              silvereddie Edward Serebrinskiy
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: