T
- The Configuration type created by this builder.public interface ConfigurationBuilder<T extends Configuration> extends Builder<T>
Modifier and Type | Method and 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(java.lang.String key,
java.lang.String value)
Adds a Property key and value.
|
ConfigurationBuilder<T> |
addRootProperty(java.lang.String key,
java.lang.String value)
Add the properties for the root node.
|
T |
build(boolean initialize)
Build the configuration and optionally initialize it.
|
AppenderComponentBuilder |
newAppender(java.lang.String name,
java.lang.String pluginName)
Returns a builder for creating Appenders.
|
AppenderRefComponentBuilder |
newAppenderRef(java.lang.String ref)
Returns a builder for creating AppenderRefs.
|
LoggerComponentBuilder |
newAsyncLogger(java.lang.String name,
Level level)
Returns a builder for creating Async Loggers.
|
LoggerComponentBuilder |
newAsyncLogger(java.lang.String name,
Level level,
boolean includeLocation)
Returns a builder for creating Async Loggers.
|
LoggerComponentBuilder |
newAsyncLogger(java.lang.String name,
java.lang.String level)
Returns a builder for creating Async Loggers.
|
LoggerComponentBuilder |
newAsyncLogger(java.lang.String name,
java.lang.String level,
boolean includeLocation)
Returns a builder for creating Async Loggers.
|
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.
|
RootLoggerComponentBuilder |
newAsyncRootLogger(java.lang.String level)
Returns a builder for creating the async root Logger.
|
RootLoggerComponentBuilder |
newAsyncRootLogger(java.lang.String level,
boolean includeLocation)
Returns a builder for creating the async root Logger.
|
<B extends ComponentBuilder<B>> |
newComponent(java.lang.String pluginName)
Returns a builder for creating generic components.
|
<B extends ComponentBuilder<B>> |
newComponent(java.lang.String name,
java.lang.String pluginName)
Returns a builder for creating generic components.
|
<B extends ComponentBuilder<B>> |
newComponent(java.lang.String name,
java.lang.String pluginName,
java.lang.String value)
Returns a builder for creating generic components.
|
CustomLevelComponentBuilder |
newCustomLevel(java.lang.String name,
int level)
Returns a builder for creating CustomLevels
|
FilterComponentBuilder |
newFilter(java.lang.String pluginName,
Filter.Result onMatch,
Filter.Result onMisMatch)
Returns a builder for creating Filters.
|
FilterComponentBuilder |
newFilter(java.lang.String pluginName,
java.lang.String onMatch,
java.lang.String onMisMatch)
Returns a builder for creating Filters.
|
LayoutComponentBuilder |
newLayout(java.lang.String pluginName)
Returns a builder for creating Layouts.
|
LoggerComponentBuilder |
newLogger(java.lang.String name,
Level level)
Returns a builder for creating Loggers.
|
LoggerComponentBuilder |
newLogger(java.lang.String name,
Level level,
boolean includeLocation)
Returns a builder for creating Loggers.
|
LoggerComponentBuilder |
newLogger(java.lang.String name,
java.lang.String level)
Returns a builder for creating Loggers.
|
LoggerComponentBuilder |
newLogger(java.lang.String name,
java.lang.String level,
boolean includeLocation)
Returns a builder for creating Loggers.
|
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.
|
RootLoggerComponentBuilder |
newRootLogger(java.lang.String level)
Returns a builder for creating the root Logger.
|
RootLoggerComponentBuilder |
newRootLogger(java.lang.String level,
boolean includeLocation)
Returns a builder for creating the root Logger.
|
ScriptComponentBuilder |
newScript(java.lang.String name,
java.lang.String language,
java.lang.String text)
Returns a builder for creating Async Loggers.
|
ScriptFileComponentBuilder |
newScriptFile(java.lang.String path)
Returns a builder for creating Async Loggers.
|
ScriptFileComponentBuilder |
newScriptFile(java.lang.String name,
java.lang.String path)
Returns a builder for creating Async Loggers.
|
ConfigurationBuilder<T> |
setAdvertiser(java.lang.String advertiser)
Set the Advertiser Plugin name.
|
ConfigurationBuilder<T> |
setConfigurationName(java.lang.String name)
Sets the name of the configuration.
|
ConfigurationBuilder<T> |
setConfigurationSource(ConfigurationSource configurationSource)
Sets the configuration source, if one exists.
|
ConfigurationBuilder<T> |
setDestination(java.lang.String destination)
Specifies the destination for StatusLogger events.
|
void |
setLoggerContext(LoggerContext loggerContext)
Sets the logger context.
|
ConfigurationBuilder<T> |
setMonitorInterval(java.lang.String intervalSeconds)
Sets the interval at which the configuration file should be checked for changes.
|
ConfigurationBuilder<T> |
setPackages(java.lang.String packages)
Sets the list of packages to search for plugins.
|
ConfigurationBuilder<T> |
setShutdownHook(java.lang.String flag)
Sets whether the shutdown hook should be disabled.
|
ConfigurationBuilder<T> |
setShutdownTimeout(long timeout,
java.util.concurrent.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(java.lang.String verbosity)
Sets whether the logging should include constructing Plugins.
|
java.lang.String |
toXmlConfiguration()
Constructs an XML configuration from this builder.
|
void |
writeXmlConfiguration(java.io.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(java.lang.String key, java.lang.String value)
key
- The property key.value
- The property value.ScriptComponentBuilder newScript(java.lang.String name, java.lang.String language, java.lang.String text)
name
- The name of the Logger.language
- The script languagetext
- The script to execute.ScriptFileComponentBuilder newScriptFile(java.lang.String path)
path
- The location of the script file.ScriptFileComponentBuilder newScriptFile(java.lang.String name, java.lang.String path)
name
- The name of the script file.path
- The location of the script file.AppenderComponentBuilder newAppender(java.lang.String name, java.lang.String pluginName)
name
- The name of the Appender.pluginName
- The Plugin type of the Appender.AppenderRefComponentBuilder newAppenderRef(java.lang.String ref)
ref
- The name of the Appender being referenced.LoggerComponentBuilder newAsyncLogger(java.lang.String name, Level level)
name
- The name of the Logger.level
- The logging Level to be assigned to the Logger.LoggerComponentBuilder newAsyncLogger(java.lang.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(java.lang.String name, java.lang.String level)
name
- The name of the Logger.level
- The logging Level to be assigned to the Logger.LoggerComponentBuilder newAsyncLogger(java.lang.String name, java.lang.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(java.lang.String level)
level
- The logging Level to be assigned to the root Logger.RootLoggerComponentBuilder newAsyncRootLogger(java.lang.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(java.lang.String pluginName)
B
- ComponentBuilder target typepluginName
- The Plugin type of the component.<B extends ComponentBuilder<B>> ComponentBuilder<B> newComponent(java.lang.String name, java.lang.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(java.lang.String name, java.lang.String pluginName, java.lang.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.CustomLevelComponentBuilder newCustomLevel(java.lang.String name, int level)
name
- The name of the custom level.level
- The integer value to be assigned to the level.FilterComponentBuilder newFilter(java.lang.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(java.lang.String pluginName, java.lang.String onMatch, java.lang.String onMisMatch)
pluginName
- The Plugin type of the Filter.onMatch
- "ACCEPT", "DENY", or "NEUTRAL"onMisMatch
- "ACCEPT", "DENY", or "NEUTRAL"LayoutComponentBuilder newLayout(java.lang.String pluginName)
pluginName
- The Plugin type of the Layout.LoggerComponentBuilder newLogger(java.lang.String name, Level level)
name
- The name of the Logger.level
- The logging Level to be assigned to the Logger.LoggerComponentBuilder newLogger(java.lang.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(java.lang.String name, java.lang.String level)
name
- The name of the Logger.level
- The logging Level to be assigned to the Logger.LoggerComponentBuilder newLogger(java.lang.String name, java.lang.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(java.lang.String level)
level
- The logging Level to be assigned to the root Logger.RootLoggerComponentBuilder newRootLogger(java.lang.String level, boolean includeLocation)
level
- The logging Level to be assigned to the root Logger.ConfigurationBuilder<T> setAdvertiser(java.lang.String advertiser)
advertiser
- The Advertiser Plugin name.ConfigurationBuilder<T> setConfigurationName(java.lang.String name)
name
- the name of the Configuration
. By default is "Constructed"
.ConfigurationBuilder<T> setConfigurationSource(ConfigurationSource configurationSource)
configurationSource
- the ConfigurationSource.ConfigurationBuilder<T> setMonitorInterval(java.lang.String intervalSeconds)
intervalSeconds
- The number of seconds that should pass between checks of the configuration file.ConfigurationBuilder<T> setPackages(java.lang.String packages)
packages
- The comma separated list of packages.ConfigurationBuilder<T> setShutdownHook(java.lang.String flag)
flag
- "disable" will prevent the shutdown hook from being set.ConfigurationBuilder<T> setShutdownTimeout(long timeout, java.util.concurrent.TimeUnit timeUnit)
setShutdownHook(String)
is set to "disable".)LoggerContext.stop(long, TimeUnit)
ConfigurationBuilder<T> setStatusLevel(Level level)
level
- The logging level.ConfigurationBuilder<T> setVerbosity(java.lang.String verbosity)
verbosity
- "disable" will hide messages from plugin construction.ConfigurationBuilder<T> setDestination(java.lang.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(java.lang.String key, java.lang.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(java.io.OutputStream output) throws java.io.IOException
output
- OutputStream to write to, will not be closedjava.io.IOException
java.lang.String toXmlConfiguration()