org.apache.log.output.net

Class SMTPOutputLogTarget

Implemented Interfaces:
ErrorAware, LogTarget

public class SMTPOutputLogTarget
extends AbstractOutputTarget

Logkit output target that logs data via SMTP (ie. email, email gateways).
Version:
CVS $Id: SMTPOutputLogTarget.java,v 1.6 2003/02/09 23:33:25 mcconnell Exp $
Authors:
Avalon Development Team
Marcus Crafter
Since:
1.1.0

Field Summary

Fields inherited from class org.apache.log.output.AbstractOutputTarget

m_formatter

Constructor Summary

SMTPOutputLogTarget(Session session, Address[] toAddresses, Address fromAddress, 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.
void
setDebug(boolean flag)
Method to enable/disable debugging on the mail session.
protected void
write(String data)
Method to write data to the log target.

Methods inherited from class org.apache.log.output.AbstractOutputTarget

close, doProcessEvent, getFormatter, open, output, setFormatter, write

Methods inherited from class org.apache.log.output.AbstractTarget

close, doProcessEvent, error, getErrorHandler, isOpen, open, processEvent, setErrorHandler

Constructor Details

SMTPOutputLogTarget

public SMTPOutputLogTarget(Session session,
                           Address[] toAddresses,
                           Address fromAddress,
                           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

Method Details

close

public void close()
Closes this log target. Sends currently buffered message, if existing.
Overrides:
close in interface 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

write

protected void write(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 interface AbstractOutputTarget
Parameters:
data - logging data to be written to target