public class SimpleEmailAppender
extends org.apache.log4j.AppenderSkeleton
Modifier and Type | Field and Description |
---|---|
protected org.apache.log4j.helpers.CyclicBuffer |
_m_cb
The _m_cb.
|
protected org.apache.log4j.spi.TriggeringEventEvaluator |
_m_evaluator
The _m_evaluator.
|
Constructor and Description |
---|
SimpleEmailAppender()
Instantiates a new simple email appender.
|
SimpleEmailAppender(org.apache.log4j.spi.TriggeringEventEvaluator evaluator)
Instantiates a new simple email appender.
|
Modifier and Type | Method and Description |
---|---|
protected void |
append(org.apache.log4j.spi.LoggingEvent event) |
protected boolean |
checkEntryConditions()
Check entry conditions.
|
void |
close() |
static void |
main(java.lang.String[] args)
The main method.
|
boolean |
requiresLayout() |
java.lang.String |
send(java.lang.String host,
int port,
java.lang.String to,
java.lang.String from,
java.lang.String subject,
java.lang.String message)
Sends an email.
|
void |
setBufferSize(int bufferSize)
Sets the buffer size.
|
void |
setFrom(java.lang.String from)
Sets the from.
|
void |
setSMTPHost(java.lang.String smtpHost)
Sets the sMTP host.
|
void |
setSubject(java.lang.String subject)
Sets the subject.
|
void |
setTo(java.lang.String to)
Sets the to.
|
protected org.apache.log4j.spi.TriggeringEventEvaluator _m_evaluator
protected org.apache.log4j.helpers.CyclicBuffer _m_cb
public SimpleEmailAppender()
public SimpleEmailAppender(org.apache.log4j.spi.TriggeringEventEvaluator evaluator)
evaluator
- the evaluatorpublic void setTo(java.lang.String to)
to
- the new topublic void setFrom(java.lang.String from)
from
- the new frompublic void setSubject(java.lang.String subject)
subject
- the new subjectpublic void setSMTPHost(java.lang.String smtpHost)
smtpHost
- the new sMTP hostpublic void setBufferSize(int bufferSize)
bufferSize
- the new buffer sizepublic java.lang.String send(java.lang.String host, int port, java.lang.String to, java.lang.String from, java.lang.String subject, java.lang.String message) throws java.lang.Exception
host
- the hostport
- the portto
- the tofrom
- the fromsubject
- the subjectmessage
- the messagejava.lang.Exception
- the exceptionprotected void append(org.apache.log4j.spi.LoggingEvent event)
append
in class org.apache.log4j.AppenderSkeleton
protected boolean checkEntryConditions()
public void close()
public boolean requiresLayout()
public static void main(java.lang.String[] args) throws java.lang.Exception
args
- the argumentsjava.lang.Exception
- the exception