org.apache.log.output.net
Class SMTPOutputLogTarget
java.lang.Object
org.apache.log.output.AbstractTarget
org.apache.log.output.AbstractOutputTarget
org.apache.log.output.net.SMTPOutputLogTarget
- All Implemented Interfaces:
- Closeable, ErrorAware, LogTarget
- public class SMTPOutputLogTarget
- extends AbstractOutputTarget
Logkit output target that logs data via SMTP (ie. email, email gateways).
- Since:
- 1.1.0
- Version:
- CVS $Id: SMTPOutputLogTarget.java,v 1.7 2003/04/17 09:13:49 donaldp Exp $
- Author:
- ,
| Constructor Summary |
SMTPOutputLogTarget(Session session, Address[] toAddresses, Address fromAddress, java.lang.String subject, int maxMsgSize, Formatter formatter)
SMTPOutputLogTarget constructor, creates a logkit output target capable of logging to SMTP (ie. |
| Method Summary |
void |
close()
Closes this log target. |
private void |
send()
Helper method to send the currently buffered message, if existing. |
void |
setDebug(boolean flag)
Method to enable/disable debugging on the mail session. |
protected void |
write(java.lang.String data)
Method to write data to the log target. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
m_session
private final Session m_session
-
m_message
private Message m_message
-
m_toAddresses
private final Address[] m_toAddresses
-
m_fromAddress
private final Address m_fromAddress
-
m_subject
private final java.lang.String m_subject
-
m_msgSize
private int m_msgSize
-
m_maxMsgSize
private final int m_maxMsgSize
-
m_buffer
private java.lang.StringBuffer m_buffer
-
SMTPOutputLogTarget
public SMTPOutputLogTarget(Session session,
Address[] toAddresses,
Address fromAddress,
java.lang.String subject,
int maxMsgSize,
Formatter formatter)
-
SMTPOutputLogTarget constructor, creates a logkit output target capable of logging to SMTP (ie. email, email gateway) targets.
- Parameters:
session - mail session to be used
toAddresses - addresses logs should be sent to
fromAddress - address logs say they come from
subject - subject line logs should use
maxMsgSize - maximum size of any log mail, in units of log events
formatter - log formatter to use
write
protected void write(java.lang.String data)
-
Method to write data to the log target. Logging data is stored in an internal buffer until the size limit is reached. When this happens the data is sent to the SMTP target, and the buffer is reset for subsequent events.
-
- Overrides:
write in class AbstractOutputTarget
-
- Parameters:
data - logging data to be written to target
close
public void close()
-
Closes this log target. Sends currently buffered message, if existing.
-
- Specified by:
close in interface Closeable
- Overrides:
close in class AbstractOutputTarget
-
setDebug
public void setDebug(boolean flag)
-
Method to enable/disable debugging on the mail session.
-
- Parameters:
flag - true to enable debugging, false to disable it
send
private void send()
-
Helper method to send the currently buffered message, if existing.
-
Please see keelframework.org for information about new Keel releases.