Class SmtpAppender.Builder
java.lang.Object
org.apache.logging.log4j.core.filter.AbstractFilterable.Builder<B>
org.apache.logging.log4j.core.appender.AbstractAppender.Builder<SmtpAppender.Builder>
org.apache.logging.log4j.core.appender.SmtpAppender.Builder
- All Implemented Interfaces:
Builder<SmtpAppender>
- Enclosing class:
- SmtpAppender
public static class SmtpAppender.Builder
extends AbstractAppender.Builder<SmtpAppender.Builder>
implements Builder<SmtpAppender>
- Since:
- 2.13.2
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionbuild()
Builds the object after all configuration has been set.Comma-separated list of BCC email addresses.setBufferSize
(int bufferSize) Number of log events to buffer before sending an email.Comma-separated list of CC email addresses.Specifies the filter used for this appender.Email address of the sender.setLayout
(Layout<? extends Serializable> layout) Specifies the layout used for the email message body.setReplyTo
(String replyTo) Comma-separated list of Reply-To email addresses.setSmtpDebug
(boolean smtpDebug) Enables or disables mail session debugging on STDOUT.setSmtpHost
(String smtpHost) Host name of SMTP server to send messages through.setSmtpPassword
(String smtpPassword) Password to authenticate with SMTP server.setSmtpPort
(int smtpPort) Port number of SMTP server to send messages through.setSmtpProtocol
(String smtpProtocol) Transport protocol to use for SMTP such as "smtp" or "smtps".setSmtpUsername
(String smtpUsername) Username to authenticate with SMTP server.setSslConfiguration
(SslConfiguration sslConfiguration) Specifies an SSL configuration for smtps connections.setSubject
(String subject) Subject template for the email messages.Comma-separated list of recipient email addresses.Methods inherited from class org.apache.logging.log4j.core.appender.AbstractAppender.Builder
getConfiguration, getErrorPrefix, getLayout, getName, getOrCreateLayout, getOrCreateLayout, isIgnoreExceptions, setConfiguration, setIgnoreExceptions, setName, withConfiguration, withIgnoreExceptions, withLayout, withName
Methods inherited from class org.apache.logging.log4j.core.filter.AbstractFilterable.Builder
asBuilder, getFilter, getPropertyArray, setPropertyArray, withFilter
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.apache.logging.log4j.core.util.Builder
getErrorPrefix, isValid
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
setTo
Comma-separated list of recipient email addresses. -
setCc
Comma-separated list of CC email addresses. -
setBcc
Comma-separated list of BCC email addresses. -
setFrom
Email address of the sender. -
setReplyTo
Comma-separated list of Reply-To email addresses. -
setSubject
Subject template for the email messages.- See Also:
-
setSmtpProtocol
Transport protocol to use for SMTP such as "smtp" or "smtps". Defaults to "smtp". -
setSmtpHost
Host name of SMTP server to send messages through. -
setSmtpPort
Port number of SMTP server to send messages through. -
setSmtpUsername
Username to authenticate with SMTP server. -
setSmtpPassword
Password to authenticate with SMTP server. -
setSmtpDebug
Enables or disables mail session debugging on STDOUT. Disabled by default. -
setBufferSize
Number of log events to buffer before sending an email. Defaults to 512. -
setSslConfiguration
Specifies an SSL configuration for smtps connections. -
setLayout
Specifies the layout used for the email message body. By default, this uses the default HTML layout.- Overrides:
setLayout
in classAbstractAppender.Builder<SmtpAppender.Builder>
-
setFilter
Specifies the filter used for this appender. By default, uses aThresholdFilter
with a level of ERROR.- Overrides:
setFilter
in classAbstractFilterable.Builder<SmtpAppender.Builder>
-
build
Description copied from interface:Builder
Builds the object after all configuration has been set. This will use default values for any unspecified attributes for the object.- Specified by:
build
in interfaceBuilder<SmtpAppender>
- Returns:
- the configured instance.
-