com.caucho.log
Class MailHandler

java.lang.Object
  extended by java.util.logging.Handler
      extended by com.caucho.log.MailHandler
All Implemented Interfaces:
AlarmListener, java.util.EventListener
Direct Known Subclasses:
MailLogHandler

public class MailHandler
extends java.util.logging.Handler
implements AlarmListener

Sends formatted messages to mail


Constructor Summary
MailHandler()
           
 
Method Summary
 void addTo(java.lang.String to)
          Adds a 'to'
 void close()
           
 void flush()
          Flushes the buffer.
 void handleAlarm(Alarm alarm)
          Handles a callback from an alarm.
 void init()
          Initialize the handler
 void publish(java.util.logging.LogRecord record)
          Publishes the record.
 void setDelayTime(Period period)
          Sets the delay time, i.e.
 void setMailIntervalMin(Period period)
          Sets the delay time, i.e.
 void setMailSession(Session session)
          Sets the mail session
 void setProperties(java.util.Properties props)
          Sets properties
 void setProperty(java.lang.String key, java.lang.String value)
          Sets a property
 java.lang.String toString()
           
 
Methods inherited from class java.util.logging.Handler
getEncoding, getErrorManager, getFilter, getFormatter, getLevel, isLoggable, reportError, setEncoding, setErrorManager, setFilter, setFormatter, setLevel
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MailHandler

public MailHandler()
Method Detail

setDelayTime

public void setDelayTime(Period period)
Sets the delay time, i.e. how long the service should accumulate messages before sending them.


setMailIntervalMin

public void setMailIntervalMin(Period period)
Sets the delay time, i.e. how long the service should accumulate messages before sending them.


setMailSession

public void setMailSession(Session session)
Sets the mail session


setProperty

public void setProperty(java.lang.String key,
                        java.lang.String value)
Sets a property


setProperties

public void setProperties(java.util.Properties props)
Sets properties


addTo

public void addTo(java.lang.String to)
           throws AddressException
Adds a 'to'

Throws:
AddressException

init

@PostConstruct
public void init()
          throws ConfigException
Initialize the handler

Throws:
ConfigException

publish

public void publish(java.util.logging.LogRecord record)
Publishes the record.

Specified by:
publish in class java.util.logging.Handler

flush

public void flush()
Flushes the buffer.

Specified by:
flush in class java.util.logging.Handler

handleAlarm

public void handleAlarm(Alarm alarm)
Description copied from interface: AlarmListener
Handles a callback from an alarm.

Specified by:
handleAlarm in interface AlarmListener

close

@PreDestroy
public void close()
Specified by:
close in class java.util.logging.Handler

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object