T - The BuiltConfiguration type.public class DefaultConfigurationBuilder<T extends BuiltConfiguration> extends Object implements ConfigurationBuilder<T>
| Constructor and Description |
|---|
DefaultConfigurationBuilder() |
DefaultConfigurationBuilder(Class<T> clazz) |
| Modifier and Type | Method and Description |
|---|---|
ConfigurationBuilder<T> |
add(AppenderComponentBuilder builder)
Adds an AppenderComponent.
|
protected ConfigurationBuilder<T> |
add(Component parent,
ComponentBuilder<?> builder) |
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()
Builds the object after all configuration has been set.
|
T |
build(boolean initialize)
Build the configuration and optionally initialize it.
|
AppenderComponentBuilder |
newAppender(String name,
String type)
Returns a builder for creating Appenders.
|
AppenderRefComponentBuilder |
newAppenderRef(String ref)
Returns a builder for creating AppenderRefs.
|
LoggerComponentBuilder |
newAsyncLogger(String name)
Returns a builder for creating Async Loggers.
|
LoggerComponentBuilder |
newAsyncLogger(String name,
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.
|
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.
|
RootLoggerComponentBuilder |
newAsyncRootLogger()
Returns a builder for creating the async root Logger.
|
RootLoggerComponentBuilder |
newAsyncRootLogger(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.
|
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.
|
<B extends ComponentBuilder<B>> |
newComponent(String type)
Returns a builder for creating generic components.
|
<B extends ComponentBuilder<B>> |
newComponent(String name,
String type)
Returns a builder for creating generic components.
|
<B extends ComponentBuilder<B>> |
newComponent(String name,
String type,
String value)
Returns a builder for creating generic components.
|
CustomLevelComponentBuilder |
newCustomLevel(String name,
int level)
Returns a builder for creating CustomLevels
|
FilterComponentBuilder |
newFilter(String type,
Filter.Result onMatch,
Filter.Result onMismatch)
Returns a builder for creating Filters.
|
FilterComponentBuilder |
newFilter(String type,
String onMatch,
String onMismatch)
Returns a builder for creating Filters.
|
KeyValuePairComponentBuilder |
newKeyValuePair(String key,
String value)
Returns a builder for creating KeyValuePair:s
|
LayoutComponentBuilder |
newLayout(String type)
Returns a builder for creating Layouts.
|
LoggerComponentBuilder |
newLogger(String name)
Returns a builder for creating Loggers.
|
LoggerComponentBuilder |
newLogger(String name,
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.
|
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.
|
PropertyComponentBuilder |
newProperty(String name,
String value)
Returns a builder for creating Property:s
|
RootLoggerComponentBuilder |
newRootLogger()
Returns a builder for creating the root Logger.
|
RootLoggerComponentBuilder |
newRootLogger(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.
|
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.
|
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)
Set the name of the configuration.
|
ConfigurationBuilder<T> |
setConfigurationSource(ConfigurationSource configurationSource)
Set the ConfigurationSource.
|
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.
|
protected ConfigurationBuilder<T> add(Component parent, ComponentBuilder<?> builder)
public ConfigurationBuilder<T> add(AppenderComponentBuilder builder)
ConfigurationBuilderadd in interface ConfigurationBuilder<T extends BuiltConfiguration>builder - The AppenderComponentBuilder with all of its attributes and sub components set.public ConfigurationBuilder<T> add(CustomLevelComponentBuilder builder)
ConfigurationBuilderadd in interface ConfigurationBuilder<T extends BuiltConfiguration>builder - The CustomLevelComponentBuilder with all of its attributes set.public ConfigurationBuilder<T> add(FilterComponentBuilder builder)
ConfigurationBuilderadd in interface ConfigurationBuilder<T extends BuiltConfiguration>builder - the FilterComponentBuilder with all of its attributes and sub components set.public ConfigurationBuilder<T> add(ScriptComponentBuilder builder)
ConfigurationBuilderadd in interface ConfigurationBuilder<T extends BuiltConfiguration>builder - The ScriptComponentBuilder with all of its attributes and sub components set.public ConfigurationBuilder<T> add(ScriptFileComponentBuilder builder)
ConfigurationBuilderadd in interface ConfigurationBuilder<T extends BuiltConfiguration>builder - The ScriptFileComponentBuilder with all of its attributes and sub components set.public ConfigurationBuilder<T> add(LoggerComponentBuilder builder)
ConfigurationBuilderadd in interface ConfigurationBuilder<T extends BuiltConfiguration>builder - The LoggerComponentBuilder with all of its attributes and sub components set.public ConfigurationBuilder<T> add(RootLoggerComponentBuilder builder)
ConfigurationBuilderadd in interface ConfigurationBuilder<T extends BuiltConfiguration>builder - The RootLoggerComponentBuilder with all of its attributes and sub components set.public ConfigurationBuilder<T> addProperty(String key, String value)
ConfigurationBuilderaddProperty in interface ConfigurationBuilder<T extends BuiltConfiguration>key - The property key.value - The property value.public T build()
Builderbuild in interface Builder<T extends BuiltConfiguration>public T build(boolean initialize)
ConfigurationBuilderbuild in interface ConfigurationBuilder<T extends BuiltConfiguration>initialize - true if the configuration should be initialized, false otherwise. Generally, Configurations
should not be initialized when they are constructed.public void writeXmlConfiguration(OutputStream output) throws IOException
ConfigurationBuilderwriteXmlConfiguration in interface ConfigurationBuilder<T extends BuiltConfiguration>output - OutputStream to write to, will not be closedIOExceptionpublic String toXmlConfiguration()
ConfigurationBuildertoXmlConfiguration in interface ConfigurationBuilder<T extends BuiltConfiguration>public ScriptComponentBuilder newScript(String name, String language, String text)
ConfigurationBuildernewScript in interface ConfigurationBuilder<T extends BuiltConfiguration>name - The name of the Logger.language - The script languagetext - The script to execute.public ScriptFileComponentBuilder newScriptFile(String path)
ConfigurationBuildernewScriptFile in interface ConfigurationBuilder<T extends BuiltConfiguration>path - The location of the script file.public ScriptFileComponentBuilder newScriptFile(String name, String path)
ConfigurationBuildernewScriptFile in interface ConfigurationBuilder<T extends BuiltConfiguration>name - The name of the script file.path - The location of the script file.public AppenderComponentBuilder newAppender(String name, String type)
ConfigurationBuildernewAppender in interface ConfigurationBuilder<T extends BuiltConfiguration>name - The name of the Appender.type - The Plugin type of the Appender.public AppenderRefComponentBuilder newAppenderRef(String ref)
ConfigurationBuildernewAppenderRef in interface ConfigurationBuilder<T extends BuiltConfiguration>ref - The name of the Appender being referenced.public LoggerComponentBuilder newAsyncLogger(String name)
ConfigurationBuildernewAsyncLogger in interface ConfigurationBuilder<T extends BuiltConfiguration>name - The name of the Logger.public LoggerComponentBuilder newAsyncLogger(String name, boolean includeLocation)
ConfigurationBuildernewAsyncLogger in interface ConfigurationBuilder<T extends BuiltConfiguration>name - The name of the Logger.includeLocation - If true include location information.public LoggerComponentBuilder newAsyncLogger(String name, Level level)
ConfigurationBuildernewAsyncLogger in interface ConfigurationBuilder<T extends BuiltConfiguration>name - The name of the Logger.level - The logging Level to be assigned to the Logger.public LoggerComponentBuilder newAsyncLogger(String name, Level level, boolean includeLocation)
ConfigurationBuildernewAsyncLogger in interface ConfigurationBuilder<T extends BuiltConfiguration>name - The name of the Logger.level - The logging Level to be assigned to the Logger.includeLocation - If true include location information.public LoggerComponentBuilder newAsyncLogger(String name, String level)
ConfigurationBuildernewAsyncLogger in interface ConfigurationBuilder<T extends BuiltConfiguration>name - The name of the Logger.level - The logging Level to be assigned to the Logger.public LoggerComponentBuilder newAsyncLogger(String name, String level, boolean includeLocation)
ConfigurationBuildernewAsyncLogger in interface ConfigurationBuilder<T extends BuiltConfiguration>name - The name of the Logger.level - The logging Level to be assigned to the Logger.includeLocation - If true include location information.public RootLoggerComponentBuilder newAsyncRootLogger()
ConfigurationBuildernewAsyncRootLogger in interface ConfigurationBuilder<T extends BuiltConfiguration>public RootLoggerComponentBuilder newAsyncRootLogger(boolean includeLocation)
ConfigurationBuildernewAsyncRootLogger in interface ConfigurationBuilder<T extends BuiltConfiguration>includeLocation - If true include location information.public RootLoggerComponentBuilder newAsyncRootLogger(Level level)
ConfigurationBuildernewAsyncRootLogger in interface ConfigurationBuilder<T extends BuiltConfiguration>level - The logging Level to be assigned to the root Logger.public RootLoggerComponentBuilder newAsyncRootLogger(Level level, boolean includeLocation)
ConfigurationBuildernewAsyncRootLogger in interface ConfigurationBuilder<T extends BuiltConfiguration>level - The logging Level to be assigned to the root Logger.includeLocation - If true include location information.public RootLoggerComponentBuilder newAsyncRootLogger(String level)
ConfigurationBuildernewAsyncRootLogger in interface ConfigurationBuilder<T extends BuiltConfiguration>level - The logging Level to be assigned to the root Logger.public RootLoggerComponentBuilder newAsyncRootLogger(String level, boolean includeLocation)
ConfigurationBuildernewAsyncRootLogger in interface ConfigurationBuilder<T extends BuiltConfiguration>level - The logging Level to be assigned to the root Logger.includeLocation - If true include location information.public <B extends ComponentBuilder<B>> ComponentBuilder<B> newComponent(String type)
ConfigurationBuildernewComponent in interface ConfigurationBuilder<T extends BuiltConfiguration>B - ComponentBuilder target typetype - The Plugin type of the component.public <B extends ComponentBuilder<B>> ComponentBuilder<B> newComponent(String name, String type)
ConfigurationBuildernewComponent in interface ConfigurationBuilder<T extends BuiltConfiguration>B - ComponentBuilder target typename - The name of the component (may be null).type - The Plugin type of the component.public <B extends ComponentBuilder<B>> ComponentBuilder<B> newComponent(String name, String type, String value)
ConfigurationBuildernewComponent in interface ConfigurationBuilder<T extends BuiltConfiguration>B - ComponentBuilder target typename - The name of the component (may be null).type - The Plugin type of the component.value - The value of the component.public PropertyComponentBuilder newProperty(String name, String value)
ConfigurationBuildernewProperty in interface ConfigurationBuilder<T extends BuiltConfiguration>name - The name of the property.value - The value of the component.public KeyValuePairComponentBuilder newKeyValuePair(String key, String value)
ConfigurationBuildernewKeyValuePair in interface ConfigurationBuilder<T extends BuiltConfiguration>key - The namevalue - The valuepublic CustomLevelComponentBuilder newCustomLevel(String name, int level)
ConfigurationBuildernewCustomLevel in interface ConfigurationBuilder<T extends BuiltConfiguration>name - The name of the custom level.level - The integer value to be assigned to the level.public FilterComponentBuilder newFilter(String type, Filter.Result onMatch, Filter.Result onMismatch)
ConfigurationBuildernewFilter in interface ConfigurationBuilder<T extends BuiltConfiguration>type - The Plugin type of the Filter.onMatch - "ACCEPT", "DENY", or "NEUTRAL"onMismatch - "ACCEPT", "DENY", or "NEUTRAL"public FilterComponentBuilder newFilter(String type, String onMatch, String onMismatch)
ConfigurationBuildernewFilter in interface ConfigurationBuilder<T extends BuiltConfiguration>type - The Plugin type of the Filter.onMatch - "ACCEPT", "DENY", or "NEUTRAL"onMismatch - "ACCEPT", "DENY", or "NEUTRAL"public LayoutComponentBuilder newLayout(String type)
ConfigurationBuildernewLayout in interface ConfigurationBuilder<T extends BuiltConfiguration>type - The Plugin type of the Layout.public LoggerComponentBuilder newLogger(String name)
ConfigurationBuildernewLogger in interface ConfigurationBuilder<T extends BuiltConfiguration>name - The name of the Logger.public LoggerComponentBuilder newLogger(String name, boolean includeLocation)
ConfigurationBuildernewLogger in interface ConfigurationBuilder<T extends BuiltConfiguration>name - The name of the Logger.includeLocation - If true include location information.public LoggerComponentBuilder newLogger(String name, Level level)
ConfigurationBuildernewLogger in interface ConfigurationBuilder<T extends BuiltConfiguration>name - The name of the Logger.level - The logging Level to be assigned to the Logger.public LoggerComponentBuilder newLogger(String name, Level level, boolean includeLocation)
ConfigurationBuildernewLogger in interface ConfigurationBuilder<T extends BuiltConfiguration>name - The name of the Logger.level - The logging Level to be assigned to the Logger.includeLocation - If true include location information.public LoggerComponentBuilder newLogger(String name, String level)
ConfigurationBuildernewLogger in interface ConfigurationBuilder<T extends BuiltConfiguration>name - The name of the Logger.level - The logging Level to be assigned to the Logger.public LoggerComponentBuilder newLogger(String name, String level, boolean includeLocation)
ConfigurationBuildernewLogger in interface ConfigurationBuilder<T extends BuiltConfiguration>name - The name of the Logger.level - The logging Level to be assigned to the Logger.includeLocation - If true include location information.public RootLoggerComponentBuilder newRootLogger()
ConfigurationBuildernewRootLogger in interface ConfigurationBuilder<T extends BuiltConfiguration>public RootLoggerComponentBuilder newRootLogger(boolean includeLocation)
ConfigurationBuildernewRootLogger in interface ConfigurationBuilder<T extends BuiltConfiguration>includeLocation - If true include location information.public RootLoggerComponentBuilder newRootLogger(Level level)
ConfigurationBuildernewRootLogger in interface ConfigurationBuilder<T extends BuiltConfiguration>level - The logging Level to be assigned to the root Logger.public RootLoggerComponentBuilder newRootLogger(Level level, boolean includeLocation)
ConfigurationBuildernewRootLogger in interface ConfigurationBuilder<T extends BuiltConfiguration>level - The logging Level to be assigned to the root Logger.includeLocation - If true include location information.public RootLoggerComponentBuilder newRootLogger(String level)
ConfigurationBuildernewRootLogger in interface ConfigurationBuilder<T extends BuiltConfiguration>level - The logging Level to be assigned to the root Logger.public RootLoggerComponentBuilder newRootLogger(String level, boolean includeLocation)
ConfigurationBuildernewRootLogger in interface ConfigurationBuilder<T extends BuiltConfiguration>level - The logging Level to be assigned to the root Logger.public ConfigurationBuilder<T> setAdvertiser(String advertiser)
ConfigurationBuildersetAdvertiser in interface ConfigurationBuilder<T extends BuiltConfiguration>advertiser - The Advertiser Plugin name.public ConfigurationBuilder<T> setConfigurationName(String name)
setConfigurationName in interface ConfigurationBuilder<T extends BuiltConfiguration>name - the name of the Configuration. By default is "Assembled".public ConfigurationBuilder<T> setConfigurationSource(ConfigurationSource configurationSource)
setConfigurationSource in interface ConfigurationBuilder<T extends BuiltConfiguration>configurationSource - the ConfigurationSourcepublic ConfigurationBuilder<T> setMonitorInterval(String intervalSeconds)
ConfigurationBuildersetMonitorInterval in interface ConfigurationBuilder<T extends BuiltConfiguration>intervalSeconds - The number of seconds that should pass between checks of the configuration file.public ConfigurationBuilder<T> setPackages(String packages)
ConfigurationBuildersetPackages in interface ConfigurationBuilder<T extends BuiltConfiguration>packages - The comma separated list of packages.public ConfigurationBuilder<T> setShutdownHook(String flag)
ConfigurationBuildersetShutdownHook in interface ConfigurationBuilder<T extends BuiltConfiguration>flag - "disable" will prevent the shutdown hook from being set.public ConfigurationBuilder<T> setShutdownTimeout(long timeout, TimeUnit timeUnit)
ConfigurationBuilderConfigurationBuilder.setShutdownHook(String) is set to "disable".)setShutdownTimeout in interface ConfigurationBuilder<T extends BuiltConfiguration>LoggerContext.stop(long, TimeUnit)public ConfigurationBuilder<T> setStatusLevel(Level level)
ConfigurationBuildersetStatusLevel in interface ConfigurationBuilder<T extends BuiltConfiguration>level - The logging level.public ConfigurationBuilder<T> setVerbosity(String verbosity)
ConfigurationBuildersetVerbosity in interface ConfigurationBuilder<T extends BuiltConfiguration>verbosity - "disable" will hide messages from plugin construction.public ConfigurationBuilder<T> setDestination(String destination)
ConfigurationBuilderout (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.setDestination in interface ConfigurationBuilder<T extends BuiltConfiguration>destination - where status log messages should be output.public void setLoggerContext(LoggerContext loggerContext)
ConfigurationBuildersetLoggerContext in interface ConfigurationBuilder<T extends BuiltConfiguration>loggerContext - the logger context.public ConfigurationBuilder<T> addRootProperty(String key, String value)
ConfigurationBuilderaddRootProperty in interface ConfigurationBuilder<T extends BuiltConfiguration>key - The property key.value - The property value.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.