Logback API
Version 0.9.8

ch.qos.logback.classic.net
Class SMTPAppender

java.lang.Object
  extended by ch.qos.logback.core.spi.ContextAwareBase
      extended by ch.qos.logback.core.AppenderBase<E>
          extended by ch.qos.logback.core.net.SMTPAppenderBase<LoggingEvent>
              extended by ch.qos.logback.classic.net.SMTPAppender
All Implemented Interfaces:
Appender<LoggingEvent>, ContextAware, FilterAttachable, LifeCycle

public class SMTPAppender
extends SMTPAppenderBase<LoggingEvent>

Send an e-mail when a specific logging event occurs, typically on errors or fatal errors. For more information about this appender, please refer to the online manual at http://logback.qos.ch/manual/appenders.html#SMTPAppender

Author:
Ceki Gülcü, Sébastien Pennec

Field Summary
protected  CyclicBuffer<LoggingEvent> cb
           
 
Fields inherited from class ch.qos.logback.core.net.SMTPAppenderBase
eventEvaluator, layout, msg, subjectLayout
 
Fields inherited from class ch.qos.logback.core.AppenderBase
name, started
 
Fields inherited from class ch.qos.logback.core.spi.ContextAwareBase
context
 
Constructor Summary
SMTPAppender()
          The default constructor will instantiate the appender with a EventEvaluator that will trigger on events with level ERROR or higher.
SMTPAppender(EventEvaluator eventEvaluator)
          Use the parameter as the EventEvaluator for this SMTPAppender.
 
Method Summary
protected  void fillBuffer(StringBuffer sbuf)
           
 int getBufferSize()
          Returns value of the BufferSize option.
protected  Layout<LoggingEvent> makeSubjectLayout(String subjectStr)
          return a layout for the subjet string as appropriate for the module.
 void setBufferSize(int bufferSize)
          The BufferSize option takes a positive integer representing the maximum number of logging events to collect in a cyclic buffer.
 void start()
          Start the appender
protected  void subAppend(LoggingEvent event)
          Perform SMTPAppender specific appending actions, mainly adding the event to a cyclic buffer.
 
Methods inherited from class ch.qos.logback.core.net.SMTPAppenderBase
addTo, append, checkEntryConditions, getFrom, getLayout, getMessage, getSMTPHost, getSubject, getTo, sendBuffer, setEvaluator, setFrom, setLayout, setMessage, setSMTPHost, setSubject, stop
 
Methods inherited from class ch.qos.logback.core.AppenderBase
addFilter, clearAllFilters, doAppend, getFilterChainDecision, getFirstFilter, getName, isStarted, setName, toString
 
Methods inherited from class ch.qos.logback.core.spi.ContextAwareBase
addError, addError, addInfo, addInfo, addStatus, addWarn, addWarn, getContext, getStatusManager, setContext
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface ch.qos.logback.core.spi.ContextAware
addError, addError, addInfo, addInfo, addStatus, addWarn, addWarn, getContext, setContext
 

Field Detail

cb

protected CyclicBuffer<LoggingEvent> cb
Constructor Detail

SMTPAppender

public SMTPAppender()
The default constructor will instantiate the appender with a EventEvaluator that will trigger on events with level ERROR or higher.


SMTPAppender

public SMTPAppender(EventEvaluator eventEvaluator)
Use the parameter as the EventEvaluator for this SMTPAppender.

Method Detail

start

public void start()
Description copied from class: SMTPAppenderBase
Start the appender

Specified by:
start in interface LifeCycle
Overrides:
start in class SMTPAppenderBase<LoggingEvent>

subAppend

protected void subAppend(LoggingEvent event)
Perform SMTPAppender specific appending actions, mainly adding the event to a cyclic buffer.

Specified by:
subAppend in class SMTPAppenderBase<LoggingEvent>

fillBuffer

protected void fillBuffer(StringBuffer sbuf)
Specified by:
fillBuffer in class SMTPAppenderBase<LoggingEvent>

setBufferSize

public void setBufferSize(int bufferSize)
The BufferSize option takes a positive integer representing the maximum number of logging events to collect in a cyclic buffer. When the BufferSize is reached, oldest events are deleted as new events are added to the buffer. By default the size of the cyclic buffer is 512 events.


getBufferSize

public int getBufferSize()
Returns value of the BufferSize option.


makeSubjectLayout

protected Layout<LoggingEvent> makeSubjectLayout(String subjectStr)
Description copied from class: SMTPAppenderBase
return a layout for the subjet string as appropriate for the module. If the subjectStr parameter is null, then a default value for subjectStr should be used.

Specified by:
makeSubjectLayout in class SMTPAppenderBase<LoggingEvent>
Returns:
a layout as appropriate for the module

Logback API
Version 0.9.8

Copyright © 2005-2008 QOS.ch. All Rights Reserved.