public abstract class SMTPAppenderBase<E> extends AppenderBase<E>
See http://logback.qos.ch/manual/appenders.html#SMTPAppender for further documentation.
| Modifier and Type | Field and Description |
|---|---|
protected CyclicBufferTracker<E> |
cbTracker |
protected Discriminator<E> |
discriminator |
protected EventEvaluator<E> |
eventEvaluator |
protected Layout<E> |
layout |
protected javax.mail.internet.MimeMessage |
mimeMsg |
protected Layout<E> |
subjectLayout |
name, startedcontext| Constructor and Description |
|---|
SMTPAppenderBase() |
| Modifier and Type | Method and Description |
|---|---|
void |
addTo(String to) |
protected void |
append(E eventObject)
Perform SMTPAppender specific appending actions, delegating some of them to
a subclass and checking if the event triggers an e-mail to be sent.
|
boolean |
checkEntryConditions()
This method determines if there is a sense in attempting to append.
|
protected abstract boolean |
eventMarksEndOfLife(E eventObject) |
protected abstract void |
fillBuffer(CyclicBuffer<E> cb,
StringBuffer sbuf) |
String |
getCharsetEncoding() |
CyclicBufferTracker<E> |
getCyclicBufferTracker() |
Discriminator<E> |
getDiscriminator() |
String |
getFrom()
Returns value of the From option.
|
Layout<E> |
getLayout() |
String |
getLocalhost() |
javax.mail.Message |
getMessage() |
String |
getPassword() |
String |
getSmtpHost()
Returns value of the SMTPHost option.
|
String |
getSMTPHost()
Alias for getSmtpHost().
|
int |
getSmtpPort()
See
setSmtpPort(int) |
int |
getSMTPPort()
Alias for
getSmtpPort() |
String |
getSubject()
Returns value of the Subject option.
|
List<String> |
getToAsListOfString() |
List<PatternLayoutBase<E>> |
getToList()
Returns value of the toList option.
|
String |
getUsername() |
boolean |
isAsynchronousSending() |
boolean |
isSSL() |
boolean |
isSTARTTLS() |
protected abstract PatternLayoutBase<E> |
makeNewToPatternLayout(String toPattern) |
protected abstract Layout<E> |
makeSubjectLayout(String subjectStr)
return a layout for the subject string as appropriate for the module.
|
protected void |
sendBuffer(CyclicBuffer<E> cb,
E lastEventObject)
Send the contents of the cyclic buffer as an e-mail message.
|
void |
setAsynchronousSending(boolean asynchronousSending)
By default, SMTAppender transmits emails asynchronously.
|
void |
setCharsetEncoding(String charsetEncoding)
Set the character set encoding of the outgoing email messages.
|
void |
setCyclicBufferTracker(CyclicBufferTracker<E> cbTracker) |
void |
setDiscriminator(Discriminator<E> discriminator) |
void |
setEvaluator(EventEvaluator<E> eventEvaluator)
The EventEvaluator option takes a string value representing the name
of the class implementing the
EventEvaluator interface. |
void |
setFrom(String from)
The From option takes a string value which should be a e-mail
address of the sender.
|
void |
setLayout(Layout<E> layout) |
void |
setLocalhost(String localhost)
Set the "mail.smtp.localhost" property to the value passed as parameter to
this method.
|
void |
setMessage(javax.mail.internet.MimeMessage msg) |
void |
setPassword(String password) |
void |
setSmtpHost(String smtpHost)
The smtpHost option takes a string value which should be a the host
name of the SMTP server that will send the e-mail message.
|
void |
setSMTPHost(String smtpHost)
Alias for smtpHost
|
void |
setSmtpPort(int port)
The port where the SMTP server is running.
|
void |
setSMTPPort(int port)
Alias for
setSmtpPort(int). |
void |
setSSL(boolean ssl) |
void |
setSTARTTLS(boolean startTLS) |
void |
setSubject(String subject)
The Subject option takes a string value which should be a the
subject of the e-mail message.
|
void |
setUsername(String username) |
void |
start()
Start the appender
|
void |
stop() |
protected abstract void |
subAppend(CyclicBuffer<E> cb,
E eventObject) |
addFilter, clearAllFilters, doAppend, getCopyOfAttachedFiltersList, getFilterChainDecision, getName, isStarted, setName, toStringaddError, addError, addInfo, addInfo, addStatus, addWarn, addWarn, getContext, getDeclaredOrigin, getStatusManager, setContextclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitaddError, addError, addInfo, addInfo, addStatus, addWarn, addWarn, getContext, setContextprotected javax.mail.internet.MimeMessage mimeMsg
protected EventEvaluator<E> eventEvaluator
protected Discriminator<E> discriminator
protected CyclicBufferTracker<E> cbTracker
protected abstract Layout<E> makeSubjectLayout(String subjectStr)
subjectStr - the desired subjectpublic void start()
start in interface LifeCyclestart in class AppenderBase<E>protected void append(E eventObject)
append in class AppenderBase<E>protected abstract boolean eventMarksEndOfLife(E eventObject)
protected abstract void subAppend(CyclicBuffer<E> cb, E eventObject)
public boolean checkEntryConditions()
It checks whether there is a set output target and also if there is a set
layout. If these checks fail, then the boolean value false is
returned.
public void stop()
stop in interface LifeCyclestop in class AppenderBase<E>public List<PatternLayoutBase<E>> getToList()
protected void sendBuffer(CyclicBuffer<E> cb, E lastEventObject)
cb - the cyclic bufferlastEventObject - the log eventprotected abstract void fillBuffer(CyclicBuffer<E> cb, StringBuffer sbuf)
public String getFrom()
public String getSubject()
public void setFrom(String from)
from - desired value of "from" fieldpublic void setSubject(String subject)
subject - desired subject textpublic void setSMTPHost(String smtpHost)
smtpHost - desired alias for SMTP hostpublic void setSmtpHost(String smtpHost)
smtpHost - desired SMTP hostnamepublic String getSMTPHost()
public String getSmtpHost()
public void setSMTPPort(int port)
setSmtpPort(int).port - desired SMTP portpublic void setSmtpPort(int port)
port - desired SMTP portpublic int getSMTPPort()
getSmtpPort()public int getSmtpPort()
setSmtpPort(int)public String getLocalhost()
public void setLocalhost(String localhost)
Useful in case the hostname for the client host is not fully qualified and as a consequence the SMTP server rejects the clients HELO/EHLO command.
localhost - the localhost namepublic CyclicBufferTracker<E> getCyclicBufferTracker()
public void setCyclicBufferTracker(CyclicBufferTracker<E> cbTracker)
public Discriminator<E> getDiscriminator()
public void setDiscriminator(Discriminator<E> discriminator)
public boolean isAsynchronousSending()
public void setAsynchronousSending(boolean asynchronousSending)
asynchronousSending - determines whether sending is done asynchronously or notpublic void addTo(String to)
protected abstract PatternLayoutBase<E> makeNewToPatternLayout(String toPattern)
public javax.mail.Message getMessage()
public void setMessage(javax.mail.internet.MimeMessage msg)
public boolean isSTARTTLS()
public void setSTARTTLS(boolean startTLS)
public boolean isSSL()
public void setSSL(boolean ssl)
public void setEvaluator(EventEvaluator<E> eventEvaluator)
EventEvaluator interface. A
corresponding object will be instantiated and assigned as the event
evaluator for the SMTPAppender.eventEvaluator - the desired event evaluatorpublic String getUsername()
public void setUsername(String username)
public String getPassword()
public void setPassword(String password)
public String getCharsetEncoding()
setCharsetEncoding(String)public void setCharsetEncoding(String charsetEncoding)
charsetEncoding - desired character encodingCopyright © 2005–2014 QOS.ch. All rights reserved.