T
- The Configuration type created by this builder.Builder<T>
DefaultConfigurationBuilder
public interface ConfigurationBuilder<T extends Configuration> extends Builder<T>
Modifier and Type | Method | Description |
---|---|---|
ConfigurationBuilder<T> |
add(AppenderComponentBuilder builder) |
Adds an AppenderComponent.
|
ConfigurationBuilder<T> |
add(CustomLevelComponentBuilder builder) |
Adds a CustomLevel component.
|
ConfigurationBuilder<T> |
add(FilterComponentBuilder builder) |
Adds a Filter component.
|
ConfigurationBuilder<T> |
add(LoggerComponentBuilder builder) |
Adds a Logger component.
|
ConfigurationBuilder<T> |
add(RootLoggerComponentBuilder builder) |
Adds the root Logger component.
|
ConfigurationBuilder<T> |
add(ScriptComponentBuilder builder) |
Adds a ScriptComponent.
|
ConfigurationBuilder<T> |
add(ScriptFileComponentBuilder builder) |
Adds a ScriptFileComponent.
|
ConfigurationBuilder<T> |
addProperty(String key,
String value) |
Adds a Property key and value.
|
ConfigurationBuilder<T> |
addRootProperty(String key,
String value) |
Add the properties for the root node.
|
T |
build(boolean initialize) |
Build the configuration and optionally initialize it.
|
AppenderComponentBuilder |
newAppender(String name,
String pluginName) |
Returns a builder for creating Appenders.
|
AppenderRefComponentBuilder |
newAppenderRef(String ref) |
Returns a builder for creating AppenderRefs.
|
LoggerComponentBuilder |
newAsyncLogger(String name,
String level) |
Returns a builder for creating Async Loggers.
|
LoggerComponentBuilder |
newAsyncLogger(String name,
String level,
boolean includeLocation) |
Returns a builder for creating Async Loggers.
|
LoggerComponentBuilder |
newAsyncLogger(String name,
Level level) |
Returns a builder for creating Async Loggers.
|
LoggerComponentBuilder |
newAsyncLogger(String name,
Level level,
boolean includeLocation) |
Returns a builder for creating Async Loggers.
|
RootLoggerComponentBuilder |
newAsyncRootLogger(String level) |
Returns a builder for creating the async root Logger.
|
RootLoggerComponentBuilder |
newAsyncRootLogger(String level,
boolean includeLocation) |
Returns a builder for creating the async root Logger.
|
RootLoggerComponentBuilder |
newAsyncRootLogger(Level level) |
Returns a builder for creating the async root Logger.
|
RootLoggerComponentBuilder |
newAsyncRootLogger(Level level,
boolean includeLocation) |
Returns a builder for creating the async root Logger.
|
<B extends ComponentBuilder<B>> |
newComponent(String pluginName) |
Returns a builder for creating generic components.
|
<B extends ComponentBuilder<B>> |
newComponent(String name,
String pluginName) |
Returns a builder for creating generic components.
|
<B extends ComponentBuilder<B>> |
newComponent(String name,
String pluginName,
String value) |
Returns a builder for creating generic components.
|
CustomLevelComponentBuilder |
newCustomLevel(String name,
int level) |
Returns a builder for creating CustomLevels
|
FilterComponentBuilder |
newFilter(String pluginName,
String onMatch,
String onMisMatch) |
Returns a builder for creating Filters.
|
FilterComponentBuilder |
newFilter(String pluginName,
Filter.Result onMatch,
Filter.Result onMisMatch) |
Returns a builder for creating Filters.
|
KeyValuePairComponentBuilder |
newKeyValuePair(String key,
String value) |
Returns a builder for creating KeyValuePair:s
|
LayoutComponentBuilder |
newLayout(String pluginName) |
Returns a builder for creating Layouts.
|
LoggerComponentBuilder |
newLogger(String name,
String level) |
Returns a builder for creating Loggers.
|
LoggerComponentBuilder |
newLogger(String name,
String level,
boolean includeLocation) |
Returns a builder for creating Loggers.
|
LoggerComponentBuilder |
newLogger(String name,
Level level) |
Returns a builder for creating Loggers.
|
LoggerComponentBuilder |
newLogger(String name,
Level level,
boolean includeLocation) |
Returns a builder for creating Loggers.
|
PropertyComponentBuilder |
newProperty(String name,
String value) |
Returns a builder for creating Property:s
|
RootLoggerComponentBuilder |
newRootLogger(String level) |
Returns a builder for creating the root Logger.
|
RootLoggerComponentBuilder |
newRootLogger(String level,
boolean includeLocation) |
Returns a builder for creating the root Logger.
|
RootLoggerComponentBuilder |
newRootLogger(Level level) |
Returns a builder for creating the root Logger.
|
RootLoggerComponentBuilder |
newRootLogger(Level level,
boolean includeLocation) |
Returns a builder for creating the root Logger.
|
ScriptComponentBuilder |
newScript(String name,
String language,
String text) |
Returns a builder for creating Async Loggers.
|
ScriptFileComponentBuilder |
newScriptFile(String path) |
Returns a builder for creating Async Loggers.
|
ScriptFileComponentBuilder |
newScriptFile(String name,
String path) |
Returns a builder for creating Async Loggers.
|
ConfigurationBuilder<T> |
setAdvertiser(String advertiser) |
Set the Advertiser Plugin name.
|
ConfigurationBuilder<T> |
setConfigurationName(String name) |
Sets the name of the configuration.
|
ConfigurationBuilder<T> |
setConfigurationSource(ConfigurationSource configurationSource) |
Sets the configuration source, if one exists.
|
ConfigurationBuilder<T> |
setDestination(String destination) |
Specifies the destination for StatusLogger events.
|
void |
setLoggerContext(LoggerContext loggerContext) |
Sets the logger context.
|
ConfigurationBuilder<T> |
setMonitorInterval(String intervalSeconds) |
Sets the interval at which the configuration file should be checked for changes.
|
ConfigurationBuilder<T> |
setPackages(String packages) |
Sets the list of packages to search for plugins.
|
ConfigurationBuilder<T> |
setShutdownHook(String flag) |
Sets whether the shutdown hook should be disabled.
|
ConfigurationBuilder<T> |
setShutdownTimeout(long timeout,
TimeUnit timeUnit) |
How long appenders and background tasks will get to shutdown when the JVM shuts down.
|
ConfigurationBuilder<T> |
setStatusLevel(Level level) |
Sets the level of the StatusLogger.
|
ConfigurationBuilder<T> |
setVerbosity(String verbosity) |
Sets whether the logging should include constructing Plugins.
|
String |
toXmlConfiguration() |
Constructs an XML configuration from this builder.
|
void |
writeXmlConfiguration(OutputStream output) |
Constructs an XML configuration from this builder.
|
ConfigurationBuilder<T> add(ScriptComponentBuilder builder)
builder
- The ScriptComponentBuilder with all of its attributes and sub components set.ConfigurationBuilder<T> add(ScriptFileComponentBuilder builder)
builder
- The ScriptFileComponentBuilder with all of its attributes and sub components set.ConfigurationBuilder<T> add(AppenderComponentBuilder builder)
builder
- The AppenderComponentBuilder with all of its attributes and sub components set.ConfigurationBuilder<T> add(CustomLevelComponentBuilder builder)
builder
- The CustomLevelComponentBuilder with all of its attributes set.ConfigurationBuilder<T> add(FilterComponentBuilder builder)
builder
- the FilterComponentBuilder with all of its attributes and sub components set.ConfigurationBuilder<T> add(LoggerComponentBuilder builder)
builder
- The LoggerComponentBuilder with all of its attributes and sub components set.ConfigurationBuilder<T> add(RootLoggerComponentBuilder builder)
builder
- The RootLoggerComponentBuilder with all of its attributes and sub components set.ConfigurationBuilder<T> addProperty(String key, String value)
key
- The property key.value
- The property value.ScriptComponentBuilder newScript(String name, String language, String text)
name
- The name of the Logger.language
- The script languagetext
- The script to execute.ScriptFileComponentBuilder newScriptFile(String path)
path
- The location of the script file.ScriptFileComponentBuilder newScriptFile(String name, String path)
name
- The name of the script file.path
- The location of the script file.AppenderComponentBuilder newAppender(String name, String pluginName)
name
- The name of the Appender.pluginName
- The Plugin type of the Appender.AppenderRefComponentBuilder newAppenderRef(String ref)
ref
- The name of the Appender being referenced.LoggerComponentBuilder newAsyncLogger(String name, Level level)
name
- The name of the Logger.level
- The logging Level to be assigned to the Logger.LoggerComponentBuilder newAsyncLogger(String name, Level level, boolean includeLocation)
name
- The name of the Logger.level
- The logging Level to be assigned to the Logger.includeLocation
- If true include location information.LoggerComponentBuilder newAsyncLogger(String name, String level)
name
- The name of the Logger.level
- The logging Level to be assigned to the Logger.LoggerComponentBuilder newAsyncLogger(String name, String level, boolean includeLocation)
name
- The name of the Logger.level
- The logging Level to be assigned to the Logger.includeLocation
- If true include location information.RootLoggerComponentBuilder newAsyncRootLogger(Level level)
level
- The logging Level to be assigned to the root Logger.RootLoggerComponentBuilder newAsyncRootLogger(Level level, boolean includeLocation)
level
- The logging Level to be assigned to the root Logger.includeLocation
- If true include location information.RootLoggerComponentBuilder newAsyncRootLogger(String level)
level
- The logging Level to be assigned to the root Logger.RootLoggerComponentBuilder newAsyncRootLogger(String level, boolean includeLocation)
level
- The logging Level to be assigned to the root Logger.includeLocation
- If true include location information.<B extends ComponentBuilder<B>> ComponentBuilder<B> newComponent(String pluginName)
B
- ComponentBuilder target typepluginName
- The Plugin type of the component.<B extends ComponentBuilder<B>> ComponentBuilder<B> newComponent(String name, String pluginName)
B
- ComponentBuilder target typename
- The name of the component (may be null).pluginName
- The Plugin type of the component.<B extends ComponentBuilder<B>> ComponentBuilder<B> newComponent(String name, String pluginName, String value)
B
- ComponentBuilder target typename
- The name of the component (may be null).pluginName
- The Plugin type of the component.value
- The value of the component.PropertyComponentBuilder newProperty(String name, String value)
name
- The name of the property.value
- The value of the component.KeyValuePairComponentBuilder newKeyValuePair(String key, String value)
key
- The namevalue
- The valueCustomLevelComponentBuilder newCustomLevel(String name, int level)
name
- The name of the custom level.level
- The integer value to be assigned to the level.FilterComponentBuilder newFilter(String pluginName, Filter.Result onMatch, Filter.Result onMisMatch)
pluginName
- The Plugin type of the Filter.onMatch
- "ACCEPT", "DENY", or "NEUTRAL"onMisMatch
- "ACCEPT", "DENY", or "NEUTRAL"FilterComponentBuilder newFilter(String pluginName, String onMatch, String onMisMatch)
pluginName
- The Plugin type of the Filter.onMatch
- "ACCEPT", "DENY", or "NEUTRAL"onMisMatch
- "ACCEPT", "DENY", or "NEUTRAL"LayoutComponentBuilder newLayout(String pluginName)
pluginName
- The Plugin type of the Layout.LoggerComponentBuilder newLogger(String name, Level level)
name
- The name of the Logger.level
- The logging Level to be assigned to the Logger.LoggerComponentBuilder newLogger(String name, Level level, boolean includeLocation)
name
- The name of the Logger.level
- The logging Level to be assigned to the Logger.includeLocation
- If true include location information.LoggerComponentBuilder newLogger(String name, String level)
name
- The name of the Logger.level
- The logging Level to be assigned to the Logger.LoggerComponentBuilder newLogger(String name, String level, boolean includeLocation)
name
- The name of the Logger.level
- The logging Level to be assigned to the Logger.includeLocation
- If true include location information.RootLoggerComponentBuilder newRootLogger(Level level)
level
- The logging Level to be assigned to the root Logger.RootLoggerComponentBuilder newRootLogger(Level level, boolean includeLocation)
level
- The logging Level to be assigned to the root Logger.includeLocation
- If true include location information.RootLoggerComponentBuilder newRootLogger(String level)
level
- The logging Level to be assigned to the root Logger.RootLoggerComponentBuilder newRootLogger(String level, boolean includeLocation)
level
- The logging Level to be assigned to the root Logger.ConfigurationBuilder<T> setAdvertiser(String advertiser)
advertiser
- The Advertiser Plugin name.ConfigurationBuilder<T> setConfigurationName(String name)
name
- the name of the Configuration
. By default is "Constructed"
.ConfigurationBuilder<T> setConfigurationSource(ConfigurationSource configurationSource)
configurationSource
- the ConfigurationSource.ConfigurationBuilder<T> setMonitorInterval(String intervalSeconds)
intervalSeconds
- The number of seconds that should pass between checks of the configuration file.ConfigurationBuilder<T> setPackages(String packages)
packages
- The comma separated list of packages.ConfigurationBuilder<T> setShutdownHook(String flag)
flag
- "disable" will prevent the shutdown hook from being set.ConfigurationBuilder<T> setShutdownTimeout(long timeout, TimeUnit timeUnit)
setShutdownHook(String)
is set to "disable".)LoggerContext.stop(long, TimeUnit)
ConfigurationBuilder<T> setStatusLevel(Level level)
level
- The logging level.ConfigurationBuilder<T> setVerbosity(String verbosity)
verbosity
- "disable" will hide messages from plugin construction.ConfigurationBuilder<T> setDestination(String destination)
out
(default) for using
standard out
, err
for using standard error
, or a file URI to
which log events will be written. If the provided URI is invalid, then the default destination of standard
out will be used.destination
- where status log messages should be output.void setLoggerContext(LoggerContext loggerContext)
loggerContext
- the logger context.ConfigurationBuilder<T> addRootProperty(String key, String value)
key
- The property key.value
- The property value.T build(boolean initialize)
initialize
- true if the configuration should be initialized, false otherwise. Generally, Configurations
should not be initialized when they are constructed.void writeXmlConfiguration(OutputStream output) throws IOException
output
- OutputStream to write to, will not be closedIOException
String toXmlConfiguration()
Copyright © 1999-2018. 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.