org.apache.logging.log4j.core.net
Class SmtpManager

java.lang.Object
  extended by org.apache.logging.log4j.core.appender.AbstractManager
      extended by org.apache.logging.log4j.core.net.SmtpManager

public class SmtpManager
extends AbstractManager

Manager for sending SMTP events.


Field Summary
 
Fields inherited from class org.apache.logging.log4j.core.appender.AbstractManager
count, LOGGER
 
Constructor Summary
protected SmtpManager(String name, Session session, MimeMessage message, org.apache.logging.log4j.core.net.SmtpManager.FactoryData data)
           
 
Method Summary
 void add(LogEvent event)
           
protected  void encodeContent(byte[] bytes, String encoding, ByteArrayOutputStream out)
           
protected  byte[] encodeContentToBytes(byte[] rawBytes, String encoding)
           
protected  byte[] formatContentToBytes(LogEvent[] priorEvents, LogEvent appendEvent, Layout<?> layout)
           
protected  String getEncoding(byte[] rawBytes, String contentType)
           
protected  InternetHeaders getHeaders(String contentType, String encoding)
           
protected  MimeMultipart getMimeMultipart(byte[] encodedBytes, InternetHeaders headers)
           
static SmtpManager getSMTPManager(String to, String cc, String bcc, String from, String replyTo, String subject, String protocol, String host, int port, String username, String password, boolean isDebug, String filterName, int numElements)
           
 void sendEvents(Layout<?> layout, LogEvent appendEvent)
          Send the contents of the cyclic buffer as an e-mail message.
protected  void sendMultipartMessage(MimeMessage message, MimeMultipart mp)
           
protected  void writeBuffer(LogEvent[] priorEvents, LogEvent appendEvent, Layout<?> layout, OutputStream out)
           
protected  void writeFooter(Layout<?> layout, OutputStream out)
           
protected  void writeHeader(Layout<?> layout, OutputStream out)
           
 
Methods inherited from class org.apache.logging.log4j.core.appender.AbstractManager
getContentFormat, getCount, getManager, getName, hasManager, release, releaseSub
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SmtpManager

protected SmtpManager(String name,
                      Session session,
                      MimeMessage message,
                      org.apache.logging.log4j.core.net.SmtpManager.FactoryData data)
Method Detail

add

public void add(LogEvent event)

getSMTPManager

public static SmtpManager getSMTPManager(String to,
                                         String cc,
                                         String bcc,
                                         String from,
                                         String replyTo,
                                         String subject,
                                         String protocol,
                                         String host,
                                         int port,
                                         String username,
                                         String password,
                                         boolean isDebug,
                                         String filterName,
                                         int numElements)

sendEvents

public void sendEvents(Layout<?> layout,
                       LogEvent appendEvent)
Send the contents of the cyclic buffer as an e-mail message.

Parameters:
layout - The layout for formatting the events.
appendEvent - The event that triggered the send.

formatContentToBytes

protected byte[] formatContentToBytes(LogEvent[] priorEvents,
                                      LogEvent appendEvent,
                                      Layout<?> layout)
                               throws IOException
Throws:
IOException

writeHeader

protected void writeHeader(Layout<?> layout,
                           OutputStream out)
                    throws IOException
Throws:
IOException

writeBuffer

protected void writeBuffer(LogEvent[] priorEvents,
                           LogEvent appendEvent,
                           Layout<?> layout,
                           OutputStream out)
                    throws IOException
Throws:
IOException

writeFooter

protected void writeFooter(Layout<?> layout,
                           OutputStream out)
                    throws IOException
Throws:
IOException

getEncoding

protected String getEncoding(byte[] rawBytes,
                             String contentType)

encodeContentToBytes

protected byte[] encodeContentToBytes(byte[] rawBytes,
                                      String encoding)
                               throws MessagingException,
                                      IOException
Throws:
MessagingException
IOException

encodeContent

protected void encodeContent(byte[] bytes,
                             String encoding,
                             ByteArrayOutputStream out)
                      throws MessagingException,
                             IOException
Throws:
MessagingException
IOException

getHeaders

protected InternetHeaders getHeaders(String contentType,
                                     String encoding)

getMimeMultipart

protected MimeMultipart getMimeMultipart(byte[] encodedBytes,
                                         InternetHeaders headers)
                                  throws MessagingException
Throws:
MessagingException

sendMultipartMessage

protected void sendMultipartMessage(MimeMessage message,
                                    MimeMultipart mp)
                             throws MessagingException
Throws:
MessagingException


Copyright © 1999-2015 Apache Software Foundation. All Rights Reserved.
Apache Logging, Apache Log4j, Log4j, Apache, the Apache feather logo, the Apache Logging project logo, and the Apache Log4j logo are trademarks of The Apache Software Foundation.