Class DefaultConfigurationBuilder<T extends BuiltConfiguration>
- java.lang.Object
-
- org.apache.logging.log4j.core.config.builder.impl.DefaultConfigurationBuilder<T>
-
- Type Parameters:
T
- The BuiltConfiguration type.
- All Implemented Interfaces:
ConfigurationBuilder<T>
,Builder<T>
public class DefaultConfigurationBuilder<T extends BuiltConfiguration> extends Object implements ConfigurationBuilder<T>
- Since:
- 2.4
-
-
Constructor Summary
Constructors Constructor Description DefaultConfigurationBuilder()
DefaultConfigurationBuilder(Class<T> clazz)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method 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, 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()
Returns a builder for creating the async root Logger.RootLoggerComponentBuilder
newAsyncRootLogger(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.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>>
ComponentBuilder<B>newComponent(String type)
Returns a builder for creating generic components.<B extends ComponentBuilder<B>>
ComponentBuilder<B>newComponent(String name, String type)
Returns a builder for creating generic components.<B extends ComponentBuilder<B>>
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 CustomLevelsFilterComponentBuilder
newFilter(String type, String onMatch, String onMismatch)
Returns a builder for creating Filters.FilterComponentBuilder
newFilter(String type, Filter.Result onMatch, Filter.Result onMismatch)
Returns a builder for creating Filters.KeyValuePairComponentBuilder
newKeyValuePair(String key, String value)
Returns a builder for creating KeyValuePair:sLayoutComponentBuilder
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, 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:sRootLoggerComponentBuilder
newRootLogger()
Returns a builder for creating the root Logger.RootLoggerComponentBuilder
newRootLogger(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.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)
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.
-
-
-
Method Detail
-
add
protected ConfigurationBuilder<T> add(Component parent, ComponentBuilder<?> builder)
-
add
public ConfigurationBuilder<T> add(AppenderComponentBuilder builder)
Description copied from interface:ConfigurationBuilder
Adds an AppenderComponent.- Specified by:
add
in interfaceConfigurationBuilder<T extends BuiltConfiguration>
- Parameters:
builder
- The AppenderComponentBuilder with all of its attributes and sub components set.- Returns:
- this builder instance.
-
add
public ConfigurationBuilder<T> add(CustomLevelComponentBuilder builder)
Description copied from interface:ConfigurationBuilder
Adds a CustomLevel component.- Specified by:
add
in interfaceConfigurationBuilder<T extends BuiltConfiguration>
- Parameters:
builder
- The CustomLevelComponentBuilder with all of its attributes set.- Returns:
- this builder instance.
-
add
public ConfigurationBuilder<T> add(FilterComponentBuilder builder)
Description copied from interface:ConfigurationBuilder
Adds a Filter component.- Specified by:
add
in interfaceConfigurationBuilder<T extends BuiltConfiguration>
- Parameters:
builder
- the FilterComponentBuilder with all of its attributes and sub components set.- Returns:
- this builder instance.
-
add
public ConfigurationBuilder<T> add(ScriptComponentBuilder builder)
Description copied from interface:ConfigurationBuilder
Adds a ScriptComponent.- Specified by:
add
in interfaceConfigurationBuilder<T extends BuiltConfiguration>
- Parameters:
builder
- The ScriptComponentBuilder with all of its attributes and sub components set.- Returns:
- this builder instance.
-
add
public ConfigurationBuilder<T> add(ScriptFileComponentBuilder builder)
Description copied from interface:ConfigurationBuilder
Adds a ScriptFileComponent.- Specified by:
add
in interfaceConfigurationBuilder<T extends BuiltConfiguration>
- Parameters:
builder
- The ScriptFileComponentBuilder with all of its attributes and sub components set.- Returns:
- this builder instance.
-
add
public ConfigurationBuilder<T> add(LoggerComponentBuilder builder)
Description copied from interface:ConfigurationBuilder
Adds a Logger component.- Specified by:
add
in interfaceConfigurationBuilder<T extends BuiltConfiguration>
- Parameters:
builder
- The LoggerComponentBuilder with all of its attributes and sub components set.- Returns:
- this builder instance.
-
add
public ConfigurationBuilder<T> add(RootLoggerComponentBuilder builder)
Description copied from interface:ConfigurationBuilder
Adds the root Logger component.- Specified by:
add
in interfaceConfigurationBuilder<T extends BuiltConfiguration>
- Parameters:
builder
- The RootLoggerComponentBuilder with all of its attributes and sub components set.- Returns:
- this builder instance.
-
addProperty
public ConfigurationBuilder<T> addProperty(String key, String value)
Description copied from interface:ConfigurationBuilder
Adds a Property key and value.- Specified by:
addProperty
in interfaceConfigurationBuilder<T extends BuiltConfiguration>
- Parameters:
key
- The property key.value
- The property value.- Returns:
- this builder instance.
-
build
public T 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<T extends BuiltConfiguration>
- Returns:
- the configured instance.
-
build
public T build(boolean initialize)
Description copied from interface:ConfigurationBuilder
Build the configuration and optionally initialize it.- Specified by:
build
in interfaceConfigurationBuilder<T extends BuiltConfiguration>
- Parameters:
initialize
- true if the configuration should be initialized, false otherwise. Generally, Configurations should not be initialized when they are constructed.- Returns:
- The constructed Configuration.
-
writeXmlConfiguration
public void writeXmlConfiguration(OutputStream output) throws IOException
Description copied from interface:ConfigurationBuilder
Constructs an XML configuration from this builder.- Specified by:
writeXmlConfiguration
in interfaceConfigurationBuilder<T extends BuiltConfiguration>
- Parameters:
output
- OutputStream to write to, will not be closed- Throws:
IOException
-
toXmlConfiguration
public String toXmlConfiguration()
Description copied from interface:ConfigurationBuilder
Constructs an XML configuration from this builder.- Specified by:
toXmlConfiguration
in interfaceConfigurationBuilder<T extends BuiltConfiguration>
- Returns:
- XML configuration
-
newScript
public ScriptComponentBuilder newScript(String name, String language, String text)
Description copied from interface:ConfigurationBuilder
Returns a builder for creating Async Loggers.- Specified by:
newScript
in interfaceConfigurationBuilder<T extends BuiltConfiguration>
- Parameters:
name
- The name of the Logger.language
- The script languagetext
- The script to execute.- Returns:
- A new ScriptComponentBuilder.
-
newScriptFile
public ScriptFileComponentBuilder newScriptFile(String path)
Description copied from interface:ConfigurationBuilder
Returns a builder for creating Async Loggers.- Specified by:
newScriptFile
in interfaceConfigurationBuilder<T extends BuiltConfiguration>
- Parameters:
path
- The location of the script file.- Returns:
- A new ScriptFileComponentBuilder.
-
newScriptFile
public ScriptFileComponentBuilder newScriptFile(String name, String path)
Description copied from interface:ConfigurationBuilder
Returns a builder for creating Async Loggers.- Specified by:
newScriptFile
in interfaceConfigurationBuilder<T extends BuiltConfiguration>
- Parameters:
name
- The name of the script file.path
- The location of the script file.- Returns:
- A new ScriptFileComponentBuilder.
-
newAppender
public AppenderComponentBuilder newAppender(String name, String type)
Description copied from interface:ConfigurationBuilder
Returns a builder for creating Appenders.- Specified by:
newAppender
in interfaceConfigurationBuilder<T extends BuiltConfiguration>
- Parameters:
name
- The name of the Appender.type
- The Plugin type of the Appender.- Returns:
- A new AppenderComponentBuilder.
-
newAppenderRef
public AppenderRefComponentBuilder newAppenderRef(String ref)
Description copied from interface:ConfigurationBuilder
Returns a builder for creating AppenderRefs.- Specified by:
newAppenderRef
in interfaceConfigurationBuilder<T extends BuiltConfiguration>
- Parameters:
ref
- The name of the Appender being referenced.- Returns:
- A new AppenderRefComponentBuilder.
-
newAsyncLogger
public LoggerComponentBuilder newAsyncLogger(String name)
Description copied from interface:ConfigurationBuilder
Returns a builder for creating Async Loggers.- Specified by:
newAsyncLogger
in interfaceConfigurationBuilder<T extends BuiltConfiguration>
- Parameters:
name
- The name of the Logger.- Returns:
- A new LoggerComponentBuilder.
-
newAsyncLogger
public LoggerComponentBuilder newAsyncLogger(String name, boolean includeLocation)
Description copied from interface:ConfigurationBuilder
Returns a builder for creating Async Loggers.- Specified by:
newAsyncLogger
in interfaceConfigurationBuilder<T extends BuiltConfiguration>
- Parameters:
name
- The name of the Logger.includeLocation
- If true include location information.- Returns:
- A new LoggerComponentBuilder.
-
newAsyncLogger
public LoggerComponentBuilder newAsyncLogger(String name, Level level)
Description copied from interface:ConfigurationBuilder
Returns a builder for creating Async Loggers.- Specified by:
newAsyncLogger
in interfaceConfigurationBuilder<T extends BuiltConfiguration>
- Parameters:
name
- The name of the Logger.level
- The logging Level to be assigned to the Logger.- Returns:
- A new LoggerComponentBuilder.
-
newAsyncLogger
public LoggerComponentBuilder newAsyncLogger(String name, Level level, boolean includeLocation)
Description copied from interface:ConfigurationBuilder
Returns a builder for creating Async Loggers.- Specified by:
newAsyncLogger
in interfaceConfigurationBuilder<T extends BuiltConfiguration>
- Parameters:
name
- The name of the Logger.level
- The logging Level to be assigned to the Logger.includeLocation
- If true include location information.- Returns:
- A new LoggerComponentBuilder.
-
newAsyncLogger
public LoggerComponentBuilder newAsyncLogger(String name, String level)
Description copied from interface:ConfigurationBuilder
Returns a builder for creating Async Loggers.- Specified by:
newAsyncLogger
in interfaceConfigurationBuilder<T extends BuiltConfiguration>
- Parameters:
name
- The name of the Logger.level
- The logging Level to be assigned to the Logger.- Returns:
- A new LoggerComponentBuilder.
-
newAsyncLogger
public LoggerComponentBuilder newAsyncLogger(String name, String level, boolean includeLocation)
Description copied from interface:ConfigurationBuilder
Returns a builder for creating Async Loggers.- Specified by:
newAsyncLogger
in interfaceConfigurationBuilder<T extends BuiltConfiguration>
- Parameters:
name
- The name of the Logger.level
- The logging Level to be assigned to the Logger.includeLocation
- If true include location information.- Returns:
- A new LoggerComponentBuilder.
-
newAsyncRootLogger
public RootLoggerComponentBuilder newAsyncRootLogger()
Description copied from interface:ConfigurationBuilder
Returns a builder for creating the async root Logger.- Specified by:
newAsyncRootLogger
in interfaceConfigurationBuilder<T extends BuiltConfiguration>
- Returns:
- A new RootLoggerComponentBuilder.
-
newAsyncRootLogger
public RootLoggerComponentBuilder newAsyncRootLogger(boolean includeLocation)
Description copied from interface:ConfigurationBuilder
Returns a builder for creating the async root Logger.- Specified by:
newAsyncRootLogger
in interfaceConfigurationBuilder<T extends BuiltConfiguration>
- Parameters:
includeLocation
- If true include location information.- Returns:
- A new RootLoggerComponentBuilder.
-
newAsyncRootLogger
public RootLoggerComponentBuilder newAsyncRootLogger(Level level)
Description copied from interface:ConfigurationBuilder
Returns a builder for creating the async root Logger.- Specified by:
newAsyncRootLogger
in interfaceConfigurationBuilder<T extends BuiltConfiguration>
- Parameters:
level
- The logging Level to be assigned to the root Logger.- Returns:
- A new RootLoggerComponentBuilder.
-
newAsyncRootLogger
public RootLoggerComponentBuilder newAsyncRootLogger(Level level, boolean includeLocation)
Description copied from interface:ConfigurationBuilder
Returns a builder for creating the async root Logger.- Specified by:
newAsyncRootLogger
in interfaceConfigurationBuilder<T extends BuiltConfiguration>
- Parameters:
level
- The logging Level to be assigned to the root Logger.includeLocation
- If true include location information.- Returns:
- A new RootLoggerComponentBuilder.
-
newAsyncRootLogger
public RootLoggerComponentBuilder newAsyncRootLogger(String level)
Description copied from interface:ConfigurationBuilder
Returns a builder for creating the async root Logger.- Specified by:
newAsyncRootLogger
in interfaceConfigurationBuilder<T extends BuiltConfiguration>
- Parameters:
level
- The logging Level to be assigned to the root Logger.- Returns:
- A new RootLoggerComponentBuilder.
-
newAsyncRootLogger
public RootLoggerComponentBuilder newAsyncRootLogger(String level, boolean includeLocation)
Description copied from interface:ConfigurationBuilder
Returns a builder for creating the async root Logger.- Specified by:
newAsyncRootLogger
in interfaceConfigurationBuilder<T extends BuiltConfiguration>
- Parameters:
level
- The logging Level to be assigned to the root Logger.includeLocation
- If true include location information.- Returns:
- A new RootLoggerComponentBuilder.
-
newComponent
public <B extends ComponentBuilder<B>> ComponentBuilder<B> newComponent(String type)
Description copied from interface:ConfigurationBuilder
Returns a builder for creating generic components.- Specified by:
newComponent
in interfaceConfigurationBuilder<T extends BuiltConfiguration>
- Type Parameters:
B
- ComponentBuilder target type- Parameters:
type
- The Plugin type of the component.- Returns:
- A new ComponentBuilder.
-
newComponent
public <B extends ComponentBuilder<B>> ComponentBuilder<B> newComponent(String name, String type)
Description copied from interface:ConfigurationBuilder
Returns a builder for creating generic components.- Specified by:
newComponent
in interfaceConfigurationBuilder<T extends BuiltConfiguration>
- Type Parameters:
B
- ComponentBuilder target type- Parameters:
name
- The name of the component (may be null).type
- The Plugin type of the component.- Returns:
- A new ComponentBuilder.
-
newComponent
public <B extends ComponentBuilder<B>> ComponentBuilder<B> newComponent(String name, String type, String value)
Description copied from interface:ConfigurationBuilder
Returns a builder for creating generic components.- Specified by:
newComponent
in interfaceConfigurationBuilder<T extends BuiltConfiguration>
- Type Parameters:
B
- ComponentBuilder target type- Parameters:
name
- The name of the component (may be null).type
- The Plugin type of the component.value
- The value of the component.- Returns:
- A new ComponentBuilder.
-
newProperty
public PropertyComponentBuilder newProperty(String name, String value)
Description copied from interface:ConfigurationBuilder
Returns a builder for creating Property:s- Specified by:
newProperty
in interfaceConfigurationBuilder<T extends BuiltConfiguration>
- Parameters:
name
- The name of the property.value
- The value of the component.- Returns:
- A new PropertyComponentBuilder.
-
newKeyValuePair
public KeyValuePairComponentBuilder newKeyValuePair(String key, String value)
Description copied from interface:ConfigurationBuilder
Returns a builder for creating KeyValuePair:s- Specified by:
newKeyValuePair
in interfaceConfigurationBuilder<T extends BuiltConfiguration>
- Parameters:
key
- The namevalue
- The value- Returns:
- A new KeyValuePairComponentBuilder.
-
newCustomLevel
public CustomLevelComponentBuilder newCustomLevel(String name, int level)
Description copied from interface:ConfigurationBuilder
Returns a builder for creating CustomLevels- Specified by:
newCustomLevel
in interfaceConfigurationBuilder<T extends BuiltConfiguration>
- Parameters:
name
- The name of the custom level.level
- The integer value to be assigned to the level.- Returns:
- A new CustomLevelComponentBuilder.
-
newFilter
public FilterComponentBuilder newFilter(String type, Filter.Result onMatch, Filter.Result onMismatch)
Description copied from interface:ConfigurationBuilder
Returns a builder for creating Filters.- Specified by:
newFilter
in interfaceConfigurationBuilder<T extends BuiltConfiguration>
- Parameters:
type
- The Plugin type of the Filter.onMatch
- "ACCEPT", "DENY", or "NEUTRAL"onMismatch
- "ACCEPT", "DENY", or "NEUTRAL"- Returns:
- A new FilterComponentBuilder.
-
newFilter
public FilterComponentBuilder newFilter(String type, String onMatch, String onMismatch)
Description copied from interface:ConfigurationBuilder
Returns a builder for creating Filters.- Specified by:
newFilter
in interfaceConfigurationBuilder<T extends BuiltConfiguration>
- Parameters:
type
- The Plugin type of the Filter.onMatch
- "ACCEPT", "DENY", or "NEUTRAL"onMismatch
- "ACCEPT", "DENY", or "NEUTRAL"- Returns:
- A new FilterComponentBuilder.
-
newLayout
public LayoutComponentBuilder newLayout(String type)
Description copied from interface:ConfigurationBuilder
Returns a builder for creating Layouts.- Specified by:
newLayout
in interfaceConfigurationBuilder<T extends BuiltConfiguration>
- Parameters:
type
- The Plugin type of the Layout.- Returns:
- A new LayoutComponentBuilder.
-
newLogger
public LoggerComponentBuilder newLogger(String name)
Description copied from interface:ConfigurationBuilder
Returns a builder for creating Loggers.- Specified by:
newLogger
in interfaceConfigurationBuilder<T extends BuiltConfiguration>
- Parameters:
name
- The name of the Logger.- Returns:
- A new LoggerComponentBuilder.
-
newLogger
public LoggerComponentBuilder newLogger(String name, boolean includeLocation)
Description copied from interface:ConfigurationBuilder
Returns a builder for creating Loggers.- Specified by:
newLogger
in interfaceConfigurationBuilder<T extends BuiltConfiguration>
- Parameters:
name
- The name of the Logger.includeLocation
- If true include location information.- Returns:
- A new LoggerComponentBuilder.
-
newLogger
public LoggerComponentBuilder newLogger(String name, Level level)
Description copied from interface:ConfigurationBuilder
Returns a builder for creating Loggers.- Specified by:
newLogger
in interfaceConfigurationBuilder<T extends BuiltConfiguration>
- Parameters:
name
- The name of the Logger.level
- The logging Level to be assigned to the Logger.- Returns:
- A new LoggerComponentBuilder.
-
newLogger
public LoggerComponentBuilder newLogger(String name, Level level, boolean includeLocation)
Description copied from interface:ConfigurationBuilder
Returns a builder for creating Loggers.- Specified by:
newLogger
in interfaceConfigurationBuilder<T extends BuiltConfiguration>
- Parameters:
name
- The name of the Logger.level
- The logging Level to be assigned to the Logger.includeLocation
- If true include location information.- Returns:
- A new LoggerComponentBuilder.
-
newLogger
public LoggerComponentBuilder newLogger(String name, String level)
Description copied from interface:ConfigurationBuilder
Returns a builder for creating Loggers.- Specified by:
newLogger
in interfaceConfigurationBuilder<T extends BuiltConfiguration>
- Parameters:
name
- The name of the Logger.level
- The logging Level to be assigned to the Logger.- Returns:
- A new LoggerComponentBuilder.
-
newLogger
public LoggerComponentBuilder newLogger(String name, String level, boolean includeLocation)
Description copied from interface:ConfigurationBuilder
Returns a builder for creating Loggers.- Specified by:
newLogger
in interfaceConfigurationBuilder<T extends BuiltConfiguration>
- Parameters:
name
- The name of the Logger.level
- The logging Level to be assigned to the Logger.includeLocation
- If true include location information.- Returns:
- A new LoggerComponentBuilder.
-
newRootLogger
public RootLoggerComponentBuilder newRootLogger()
Description copied from interface:ConfigurationBuilder
Returns a builder for creating the root Logger.- Specified by:
newRootLogger
in interfaceConfigurationBuilder<T extends BuiltConfiguration>
- Returns:
- A new RootLoggerComponentBuilder.
-
newRootLogger
public RootLoggerComponentBuilder newRootLogger(boolean includeLocation)
Description copied from interface:ConfigurationBuilder
Returns a builder for creating the root Logger.- Specified by:
newRootLogger
in interfaceConfigurationBuilder<T extends BuiltConfiguration>
- Parameters:
includeLocation
- If true include location information.- Returns:
- A new RootLoggerComponentBuilder.
-
newRootLogger
public RootLoggerComponentBuilder newRootLogger(Level level)
Description copied from interface:ConfigurationBuilder
Returns a builder for creating the root Logger.- Specified by:
newRootLogger
in interfaceConfigurationBuilder<T extends BuiltConfiguration>
- Parameters:
level
- The logging Level to be assigned to the root Logger.- Returns:
- A new RootLoggerComponentBuilder.
-
newRootLogger
public RootLoggerComponentBuilder newRootLogger(Level level, boolean includeLocation)
Description copied from interface:ConfigurationBuilder
Returns a builder for creating the root Logger.- Specified by:
newRootLogger
in interfaceConfigurationBuilder<T extends BuiltConfiguration>
- Parameters:
level
- The logging Level to be assigned to the root Logger.includeLocation
- If true include location information.- Returns:
- A new RootLoggerComponentBuilder.
-
newRootLogger
public RootLoggerComponentBuilder newRootLogger(String level)
Description copied from interface:ConfigurationBuilder
Returns a builder for creating the root Logger.- Specified by:
newRootLogger
in interfaceConfigurationBuilder<T extends BuiltConfiguration>
- Parameters:
level
- The logging Level to be assigned to the root Logger.- Returns:
- A new RootLoggerComponentBuilder.
-
newRootLogger
public RootLoggerComponentBuilder newRootLogger(String level, boolean includeLocation)
Description copied from interface:ConfigurationBuilder
Returns a builder for creating the root Logger.- Specified by:
newRootLogger
in interfaceConfigurationBuilder<T extends BuiltConfiguration>
- Parameters:
level
- The logging Level to be assigned to the root Logger.- Returns:
- A new RootLoggerComponentBuilder.
-
setAdvertiser
public ConfigurationBuilder<T> setAdvertiser(String advertiser)
Description copied from interface:ConfigurationBuilder
Set the Advertiser Plugin name.- Specified by:
setAdvertiser
in interfaceConfigurationBuilder<T extends BuiltConfiguration>
- Parameters:
advertiser
- The Advertiser Plugin name.- Returns:
- this builder instance.
-
setConfigurationName
public ConfigurationBuilder<T> setConfigurationName(String name)
Set the name of the configuration.- Specified by:
setConfigurationName
in interfaceConfigurationBuilder<T extends BuiltConfiguration>
- Parameters:
name
- the name of theConfiguration
. By default is"Assembled"
.- Returns:
- this builder instance
-
setConfigurationSource
public ConfigurationBuilder<T> setConfigurationSource(ConfigurationSource configurationSource)
Set the ConfigurationSource.- Specified by:
setConfigurationSource
in interfaceConfigurationBuilder<T extends BuiltConfiguration>
- Parameters:
configurationSource
- theConfigurationSource
- Returns:
- this builder instance
-
setMonitorInterval
public ConfigurationBuilder<T> setMonitorInterval(String intervalSeconds)
Description copied from interface:ConfigurationBuilder
Sets the interval at which the configuration file should be checked for changes.- Specified by:
setMonitorInterval
in interfaceConfigurationBuilder<T extends BuiltConfiguration>
- Parameters:
intervalSeconds
- The number of seconds that should pass between checks of the configuration file.- Returns:
- this builder instance.
-
setPackages
public ConfigurationBuilder<T> setPackages(String packages)
Description copied from interface:ConfigurationBuilder
Sets the list of packages to search for plugins.- Specified by:
setPackages
in interfaceConfigurationBuilder<T extends BuiltConfiguration>
- Parameters:
packages
- The comma separated list of packages.- Returns:
- this builder instance.
-
setShutdownHook
public ConfigurationBuilder<T> setShutdownHook(String flag)
Description copied from interface:ConfigurationBuilder
Sets whether the shutdown hook should be disabled.- Specified by:
setShutdownHook
in interfaceConfigurationBuilder<T extends BuiltConfiguration>
- Parameters:
flag
- "disable" will prevent the shutdown hook from being set.- Returns:
- this builder instance.
-
setShutdownTimeout
public ConfigurationBuilder<T> setShutdownTimeout(long timeout, TimeUnit timeUnit)
Description copied from interface:ConfigurationBuilder
How long appenders and background tasks will get to shutdown when the JVM shuts down. Default is zero which mean that each appender uses its default timeout, and don't wait for background tasks. Not all appenders will honor this, it is a hint and not an absolute guarantee that the shutdown procedure will not take longer. Setting this too low increase the risk of losing outstanding log events not yet written to the final destination. (Not used ifConfigurationBuilder.setShutdownHook(String)
is set to "disable".)- Specified by:
setShutdownTimeout
in interfaceConfigurationBuilder<T extends BuiltConfiguration>
- Returns:
- this builder instance.
- See Also:
LoggerContext.stop(long, TimeUnit)
-
setStatusLevel
public ConfigurationBuilder<T> setStatusLevel(Level level)
Description copied from interface:ConfigurationBuilder
Sets the level of the StatusLogger.- Specified by:
setStatusLevel
in interfaceConfigurationBuilder<T extends BuiltConfiguration>
- Parameters:
level
- The logging level.- Returns:
- this builder instance.
-
setVerbosity
public ConfigurationBuilder<T> setVerbosity(String verbosity)
Description copied from interface:ConfigurationBuilder
Sets whether the logging should include constructing Plugins.- Specified by:
setVerbosity
in interfaceConfigurationBuilder<T extends BuiltConfiguration>
- Parameters:
verbosity
- "disable" will hide messages from plugin construction.- Returns:
- this builder instance.
-
setDestination
public ConfigurationBuilder<T> setDestination(String destination)
Description copied from interface:ConfigurationBuilder
Specifies the destination for StatusLogger events. This can beout
(default) for usingstandard out
,err
for usingstandard 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.- Specified by:
setDestination
in interfaceConfigurationBuilder<T extends BuiltConfiguration>
- Parameters:
destination
- where status log messages should be output.- Returns:
- this builder instance.
-
setLoggerContext
public void setLoggerContext(LoggerContext loggerContext)
Description copied from interface:ConfigurationBuilder
Sets the logger context.- Specified by:
setLoggerContext
in interfaceConfigurationBuilder<T extends BuiltConfiguration>
- Parameters:
loggerContext
- the logger context.
-
addRootProperty
public ConfigurationBuilder<T> addRootProperty(String key, String value)
Description copied from interface:ConfigurationBuilder
Add the properties for the root node.- Specified by:
addRootProperty
in interfaceConfigurationBuilder<T extends BuiltConfiguration>
- Parameters:
key
- The property key.value
- The property value.- Returns:
- this builder instance.
-
-