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:
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.html,v 1.1 2003/10/29 14:35:45 leosimons Exp $
Author:
Avalon Development Team, Marcus Crafter

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
doProcessEvent, getFormatter, open, output, setFormatter
 
Methods inherited from class org.apache.log.output.AbstractTarget
error, getErrorHandler, isOpen, processEvent, setErrorHandler
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

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 Detail

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 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.

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


Copyright © 2001 Apache Jakarta Project. All Rights Reserved.