@Plugin(name="SMTP", category="Core", elementType="appender", printObject=true) public final class SmtpAppender extends AbstractAppender
The number of logging events delivered in this e-mail depend on the value of
BufferSize option. The SmtpAppender
keeps only the last
BufferSize
logging events in its cyclic buffer. This keeps
memory requirements at a reasonable level while still delivering useful
application context.
By default, an email message will formatted as HTML. This can be modified by
setting a layout for the appender.
By default, an email message will be sent when an ERROR or higher severity
message is appended. This can be modified by setting a filter for the
appender.
Modifier and Type | Class and Description |
---|---|
static class |
SmtpAppender.Builder |
LifeCycle.State
DEFAULT_STOP_TIMEOUT, DEFAULT_STOP_TIMEUNIT, LOGGER
ELEMENT_TYPE
Modifier and Type | Method and Description |
---|---|
void |
append(LogEvent event)
Perform SmtpAppender specific appending actions, mainly adding the event
to a cyclic buffer and checking if the event triggers an e-mail to be
sent.
|
static SmtpAppender |
createAppender(Configuration config,
String name,
String to,
String cc,
String bcc,
String from,
String replyTo,
String subject,
String smtpProtocol,
String smtpHost,
String smtpPortStr,
String smtpUsername,
String smtpPassword,
String smtpDebug,
String bufferSizeStr,
Layout<? extends Serializable> layout,
Filter filter,
String ignore)
Deprecated.
Use
newBuilder() to create and configure a SmtpAppender.Builder instance. |
boolean |
isFiltered(LogEvent event)
Capture all events in CyclicBuffer.
|
static SmtpAppender.Builder |
newBuilder() |
error, error, error, getHandler, getLayout, getName, ignoreExceptions, parseInt, requiresLocation, setHandler, toSerializable, toString
addFilter, getFilter, getPropertyArray, hasFilter, removeFilter, start, stop, stop
equalsImpl, getState, getStatusLogger, hashCodeImpl, initialize, isInitialized, isStarted, isStarting, isStopped, isStopping, setStarted, setStarting, setState, setStopped, setStopping, stop, stop
@PluginBuilderFactory public static SmtpAppender.Builder newBuilder()
public static SmtpAppender createAppender(@PluginConfiguration Configuration config, @PluginAttribute(value="name") @Required String name, @PluginAttribute(value="to") String to, @PluginAttribute(value="cc") String cc, @PluginAttribute(value="bcc") String bcc, @PluginAttribute(value="from") String from, @PluginAttribute(value="replyTo") String replyTo, @PluginAttribute(value="subject") String subject, @PluginAttribute(value="smtpProtocol") String smtpProtocol, @PluginAttribute(value="smtpHost") String smtpHost, @PluginAttribute(value="smtpPort",defaultString="0") @ValidPort String smtpPortStr, @PluginAttribute(value="smtpUsername") String smtpUsername, @PluginAttribute(value="smtpPassword",sensitive=true) String smtpPassword, @PluginAttribute(value="smtpDebug") String smtpDebug, @PluginAttribute(value="bufferSize") String bufferSizeStr, @PluginElement(value="Layout") Layout<? extends Serializable> layout, @PluginElement(value="Filter") Filter filter, @PluginAttribute(value="ignoreExceptions") String ignore)
newBuilder()
to create and configure a SmtpAppender.Builder
instance.SmtpAppender.Builder
public boolean isFiltered(LogEvent event)
isFiltered
in interface Filterable
isFiltered
in class AbstractFilterable
event
- The Log event.Copyright © 1999-2021 The Apache Software Foundation. All Rights Reserved.
Apache Logging, Apache Log4j, Log4j, Apache, the Apache feather logo, the Apache Logging project logo, and the Apache Log4j logo are trademarks of The Apache Software Foundation.