@Plugin(name="SMTPx",
category="Core",
elementType="appender",
printObject=true)
public class ExtendedSmtpAppender
extends org.apache.logging.log4j.core.appender.AbstractAppender
Modifier and Type | Method and Description |
---|---|
void |
append(org.apache.logging.log4j.core.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 ExtendedSmtpAppender |
createAppender(String name,
String to,
String cc,
String bcc,
String from,
String replyTo,
String subject,
String smtpProtocol,
String smtpHost,
int smtpPort,
String smtpUsername,
String smtpPassword,
boolean smtpDebug,
int bufferSize,
org.apache.logging.log4j.core.Layout<? extends Serializable> layout,
org.apache.logging.log4j.core.Filter filter,
boolean ignoreExceptions,
int burstSummarizingSeconds,
char bsCountInSubject,
boolean bsLoggername,
int bsMessagePrefixLength,
boolean bsMessageMaskDigits,
boolean bsExceptionClass,
boolean bsExceptionOrigin,
boolean bsRootExceptionClass)
Create an ExtendedSmtpAppender.
|
boolean |
isFiltered(org.apache.logging.log4j.core.LogEvent event)
Capture all events in CyclicBuffer.
|
void |
stop() |
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
@PluginFactory public static ExtendedSmtpAppender createAppender(@PluginAttribute(value="name") @Required(message="SMTP.name is missing") String name, @PluginAttribute(value="to") String to, @PluginAttribute(value="cc") String cc, @PluginAttribute(value="bcc") String bcc, @PluginAttribute(value="from") @Required(message="SMTP.from is missing") String from, @PluginAttribute(value="replyTo") String replyTo, @PluginAttribute(value="subject") @Required(message="SMTP.subject is missing") String subject, @PluginAttribute(value="smtpProtocol",defaultString="smtp") String smtpProtocol, @PluginAttribute(value="smtpHost") @Required(message="SMTP.smtpHost is missing") String smtpHost, @PluginAttribute(value="smtpPort") int smtpPort, @PluginAttribute(value="smtpUsername") String smtpUsername, @PluginAttribute(value="smtpPassword") String smtpPassword, @PluginAttribute(value="smtpDebug") boolean smtpDebug, @PluginAttribute(value="bufferSize",defaultInt=10) int bufferSize, @PluginElement(value="Layout") org.apache.logging.log4j.core.Layout<? extends Serializable> layout, @PluginElement(value="Filter") org.apache.logging.log4j.core.Filter filter, @PluginAttribute(value="ignoreExceptions",defaultBoolean=true) boolean ignoreExceptions, @PluginAttribute(value="burstSummarizingSeconds") int burstSummarizingSeconds, @PluginAttribute(value="bsCountInSubject") char bsCountInSubject, @PluginAttribute(value="bsLoggername") boolean bsLoggername, @PluginAttribute(value="bsMessagePrefixLength",defaultInt=1000) int bsMessagePrefixLength, @PluginAttribute(value="bsMessageMaskDigits") boolean bsMessageMaskDigits, @PluginAttribute(value="bsExceptionClass",defaultBoolean=true) boolean bsExceptionClass, @PluginAttribute(value="bsExceptionOrigin") boolean bsExceptionOrigin, @PluginAttribute(value="bsRootExceptionClass") boolean bsRootExceptionClass)
name
- The name of the Appender. Required.to
- The comma-separated list of recipient email addresses.cc
- The comma-separated list of CC email addresses.bcc
- The comma-separated list of BCC email addresses.from
- The email address of the sender. Required.replyTo
- The comma-separated list of reply-to email addresses.subject
- The subject as plain text or as pattern for PatternLayoutsmtpProtocol
- The SMTP transport protocol (such as "smtps", defaults to "smtp").smtpHost
- The SMTP hostname to send to. Required.smtpUsername
- The username required to authenticate against the SMTP server.smtpPassword
- The password required to authenticate against the SMTP server.smtpDebug
- Enable mail session debuging on STDOUT.bufferSize
- How many log events should be buffered for inclusion in the message? Default is 10.layout
- The layout to use (defaults to HtmlLayout).filter
- The Filter or null (defaults to ThresholdFilter, level of ERROR).ignoreExceptions
- If "true"
(the default) exceptions encountered when appending events are logged; otherwise
they are propagated to the caller.burstSummarizingSeconds
- Number of seconds to summarize similar log messages over. <= 0 to disable this feature (the default).bsCountInSubject
- Shall the number of summarized events be put in the subject? F or S for at front/start, B or E for
behind/at end; default is no count in subject.bsLoggername
- For summarizing the logger name is relevant; default: false.bsMessagePrefixLength
- For summarizing this number of characters from the beginning of the message text are relevant;
default: 30.bsMessageMaskDigits
- For summarizing, digits in the message text shall be masked, so their concrete value is irrelevant;
default: false.bsExceptionClass
- For summarizing the exception class name is relevant; default: true.bsExceptionOrigin
- For summarizing the first line of the exception stack trace is relevant; default: false.bsRootExceptionClass
- For summarizing the class name of the root cause is relevant; default: false.public void stop()
stop
in interface org.apache.logging.log4j.core.LifeCycle
stop
in class org.apache.logging.log4j.core.AbstractLifeCycle
public boolean isFiltered(org.apache.logging.log4j.core.LogEvent event)
isFiltered
in interface org.apache.logging.log4j.core.filter.Filterable
isFiltered
in class org.apache.logging.log4j.core.filter.AbstractFilterable
event
- The Log event.public void append(org.apache.logging.log4j.core.LogEvent event)
event
- The Log event.Copyright © 2005–2022. All rights reserved.