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

Log4j2 using SMTP Appender- Mail is sent without body content(Blank mail)

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 2.3
    • Fix Version/s: 2.3
    • Labels:
      None
    • Environment:

      Glasfish - 4.1
      JDK 1.7
      JPA 2.1
      Netbeans IDE 8.0.2

      Description

      Trying to send mail using Log4j2 SMTP Appender to log error events
      But on error event Mail is sent but the content of the mail are blank always, please advice unable to understand this...

      Below is the log4j2.xml configuration and SMTP DEBUG logs(email ids and host/user/passwords are changed below)

      log4j2.xml :

      <?xml version="1.0" encoding="UTF-8"?>

      <Configuration status="TRACE">
      <Properties>
      <Property name="log-path">c:
      test</Property> <!-- Local -->

      </Properties>

      <Appenders>

      <SMTP name="Mailer"
      smtpProtocol="smtps" smtpUsername="yog@gmail.com"
      subject="Error Mail" to="yog@gmail.com" from="yog@gmail.com" smtpPassword="abc"
      smtpHost="smtp.gmail.com" smtpPort="465"
      bufferSize="1" smtpDebug="true" ignoreExceptions="false">
      <!-ThresholdFilter level="error" onMatch="ACCEPT" onMismatch="DENY" /->
      <!--<PatternLayout>
      <pattern>%d

      {yyyy-MM-dd HH:mm:ss}

      %5p (%C:%M:%L) - %m%n</pattern>
      </PatternLayout>-->
      <HTMLLayout charset="UTF-8" title="Error Logs" contentType="text/html" />
      </SMTP>
      <Async name="AsyncMailer" bufferSize="1">
      <AppenderRef ref="Mailer" />
      </Async>
      </Appenders>

      <Loggers>

      <Logger name="com.test" additivity="false">
      <AppenderRef ref="AsyncMailer"/>
      </Logger>

      <Root level="debug">
      <AppenderRef ref="AsyncMailer"/>
      </Root>
      </Loggers>
      </Configuration>

      SMTP DEBUG Logs :

      Info: DEBUG: getProvider() returning javax.mail.Provider[TRANSPORT,smtps,com.sun.mail.smtp.SMTPSSLTransport,Oracle]
      Info: DEBUG SMTP: need username and password for authentication
      Info: DEBUG SMTP: useEhlo true, useAuth true
      Info: DEBUG SMTP: trying to connect to host "smtp.gmail.com", port 465, isSSL true
      Info: 220 smtp.gmail.com ESMTP v11sm3496663itf.6 - gsmtp
      Info: DEBUG SMTP: connected to host "smtp.gmail.com", port: 465
      Info: EHLO MUMCH-29666.tcil.com
      Info: 250-smtp.gmail.com at your service, [14.141.26.106]
      Info: 250-SIZE 35882577
      Info: 250-8BITMIME
      Info: 250-AUTH LOGIN PLAIN XOAUTH2 PLAIN-CLIENTTOKEN OAUTHBEARER XOAUTH
      Info: 250-ENHANCEDSTATUSCODES
      Info: 250-PIPELINING
      Info: 250-CHUNKING
      Info: 250 SMTPUTF8
      Info: DEBUG SMTP: Found extension "SIZE", arg "35882577"
      Info: DEBUG SMTP: Found extension "8BITMIME", arg ""
      Info: DEBUG SMTP: Found extension "AUTH", arg "LOGIN PLAIN XOAUTH2 PLAIN-CLIENTTOKEN OAUTHBEARER XOAUTH"
      Info: DEBUG SMTP: Found extension "ENHANCEDSTATUSCODES", arg ""
      Info: DEBUG SMTP: Found extension "PIPELINING", arg ""
      Info: DEBUG SMTP: Found extension "CHUNKING", arg ""
      Info: DEBUG SMTP: Found extension "SMTPUTF8", arg ""
      Info: DEBUG SMTP: Attempt to authenticate using mechanisms: LOGIN PLAIN DIGEST-MD5 NTLM
      Info: DEBUG SMTP: AUTH LOGIN command trace suppressed
      Info: DEBUG SMTP: AUTH LOGIN succeeded
      Info: DEBUG SMTP: use8bit false
      Info: MAIL FROM:<yog@gmail.com>
      Info: 250 2.1.0 OK v11sm3496663itf.6 - gsmtp
      Info: RCPT TO:<yog@gmail.com>
      Info: 250 2.1.5 OK v11sm3496663itf.6 - gsmtp
      Info: DEBUG SMTP: Verified Addresses
      Info: DEBUG SMTP: yog@gmail.com
      Info: DATA
      Info: 354 Go ahead v11sm3496663itf.6 - gsmtp
      Info: Date: Fri, 15 Dec 2017 12:00:09 +0530 (IST)
      Info: From: yog@gmail.com
      Info: To: yog@gmail.com
      Info: Message-ID: <8185101.5.1513319409057@MUMCH-29666>
      Info: Subject: Error Mail
      Info: MIME-Version: 1.0
      Info: Content-Type: multipart/mixed;
      Info: boundary="----=_Part_4_18607454.1513319409057"
      Info: .
      Info: 250 2.0.0 OK 1513319463 v11sm3496663itf.6 - gsmtp
      Info: DEBUG SMTP: message successfully delivered to mail server
      Info: QUIT
      Info: 221 2.0.0 closing connection v11sm3496663itf.6 - gsmtp

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              patily Yogesh
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated: