Interface ConfigurationBuilder<T extends Configuration>
- Type Parameters:
- T- The Configuration type created by this builder.
- All Superinterfaces:
- Builder<T>
- All Known Implementing Classes:
- DefaultConfigurationBuilder
Interface for building logging configurations.
- Since:
- 2.4
- 
Method SummaryModifier and TypeMethodDescriptionadd(AppenderComponentBuilder builder) Adds an AppenderComponent.add(CustomLevelComponentBuilder builder) Adds a CustomLevel component.add(FilterComponentBuilder builder) Adds a Filter component.add(LoggerComponentBuilder builder) Adds a Logger component.add(RootLoggerComponentBuilder builder) Adds the root Logger component.add(ScriptComponentBuilder builder) Adds a ScriptComponent.add(ScriptFileComponentBuilder builder) Adds a ScriptFileComponent.default ConfigurationBuilder<T>addComponent(ComponentBuilder<?> builder) Adds a top level component.addProperty(String key, String value) Adds a Property key and value.addRootProperty(String key, String value) Add the properties for the root node.build(boolean initialize) Build the configuration and optionally initialize it.newAppender(String name, String pluginName) Returns a builder for creating Appenders.newAppenderRef(String ref) Returns a builder for creating AppenderRefs.newAsyncLogger(String name) Returns a builder for creating Async Loggers.newAsyncLogger(String name, boolean includeLocation) Returns a builder for creating Async Loggers.newAsyncLogger(String name, String level) Returns a builder for creating Async Loggers.newAsyncLogger(String name, String level, boolean includeLocation) Returns a builder for creating Async Loggers.newAsyncLogger(String name, Level level) Returns a builder for creating Async Loggers.newAsyncLogger(String name, Level level, boolean includeLocation) Returns a builder for creating Async Loggers.Returns a builder for creating the async root Logger.newAsyncRootLogger(boolean includeLocation) Returns a builder for creating the async root Logger.newAsyncRootLogger(String level) Returns a builder for creating the async root Logger.newAsyncRootLogger(String level, boolean includeLocation) Returns a builder for creating the async root Logger.newAsyncRootLogger(Level level) Returns a builder for creating the async root Logger.newAsyncRootLogger(Level level, boolean includeLocation) Returns a builder for creating the async root Logger.<B extends ComponentBuilder<B>>
 ComponentBuilder<B>newComponent(String pluginName) Returns a builder for creating generic components.<B extends ComponentBuilder<B>>
 ComponentBuilder<B>newComponent(String name, String pluginName) Returns a builder for creating generic components.<B extends ComponentBuilder<B>>
 ComponentBuilder<B>newComponent(String name, String pluginName, String value) Returns a builder for creating generic components.newCustomLevel(String name, int level) Returns a builder for creating CustomLevelsReturns a builder for creating Filters.newFilter(String pluginName, Filter.Result onMatch, Filter.Result onMismatch) Returns a builder for creating Filters.newKeyValuePair(String key, String value) Returns a builder for creating KeyValuePair:sReturns a builder for creating Layouts.Returns a builder for creating Loggers.Returns a builder for creating Loggers.Returns a builder for creating Loggers.Returns a builder for creating Loggers.Returns a builder for creating Loggers.Returns a builder for creating Loggers.newProperty(String name, String value) Returns a builder for creating Property:sReturns a builder for creating the root Logger.newRootLogger(boolean includeLocation) Returns a builder for creating the root Logger.newRootLogger(String level) Returns a builder for creating the root Logger.newRootLogger(String level, boolean includeLocation) Returns a builder for creating the root Logger.newRootLogger(Level level) Returns a builder for creating the root Logger.newRootLogger(Level level, boolean includeLocation) Returns a builder for creating the root Logger.Returns a builder for creating Async Loggers.newScriptFile(String path) Returns a builder for creating Async Loggers.newScriptFile(String name, String path) Returns a builder for creating Async Loggers.setAdvertiser(String advertiser) Set the Advertiser Plugin name.setConfigurationName(String name) Sets the name of the configuration.setConfigurationSource(ConfigurationSource configurationSource) Sets the configuration source, if one exists.setDestination(String destination) Specifies the destination for StatusLogger events.voidsetLoggerContext(LoggerContext loggerContext) Sets the logger context.setMonitorInterval(String intervalSeconds) Sets the interval at which the configuration file should be checked for changes.setPackages(String packages) Sets the list of packages to search for plugins.setShutdownHook(String flag) Sets whether the shutdown hook should be disabled.setShutdownTimeout(long timeout, TimeUnit timeUnit) How long appenders and background tasks will get to shutdown when the JVM shuts down.setStatusLevel(Level level) Sets the level of the StatusLogger.setVerbosity(String verbosity) Sets whether the logging should include constructing Plugins.Constructs an XML configuration from this builder.voidwriteXmlConfiguration(OutputStream output) Constructs an XML configuration from this builder.Methods inherited from interface org.apache.logging.log4j.core.util.Builderbuild, getErrorPrefix, isValid
- 
Method Details- 
addAdds a ScriptComponent.- Parameters:
- builder- The ScriptComponentBuilder with all of its attributes and sub components set.
- Returns:
- this builder instance.
 
- 
addAdds a ScriptFileComponent.- Parameters:
- builder- The ScriptFileComponentBuilder with all of its attributes and sub components set.
- Returns:
- this builder instance.
 
- 
addAdds an AppenderComponent.- Parameters:
- builder- The AppenderComponentBuilder with all of its attributes and sub components set.
- Returns:
- this builder instance.
 
- 
addAdds a CustomLevel component.- Parameters:
- builder- The CustomLevelComponentBuilder with all of its attributes set.
- Returns:
- this builder instance.
 
- 
addComponentAdds a top level component.- Parameters:
- builder- The ComponentBuilder with all of its attributes and sub components set.
- Returns:
- this builder instance.
- Since:
- 2.25.0
 
- 
addAdds a Filter component.- Parameters:
- builder- the FilterComponentBuilder with all of its attributes and sub components set.
- Returns:
- this builder instance.
 
- 
addAdds a Logger component.- Parameters:
- builder- The LoggerComponentBuilder with all of its attributes and sub components set.
- Returns:
- this builder instance.
 
- 
addAdds the root Logger component.- Parameters:
- builder- The RootLoggerComponentBuilder with all of its attributes and sub components set.
- Returns:
- this builder instance.
 
- 
addPropertyAdds a Property key and value.- Parameters:
- key- The property key.
- value- The property value.
- Returns:
- this builder instance.
 
- 
newScriptReturns a builder for creating Async Loggers.- Parameters:
- name- The name of the Logger.
- language- The script language
- text- The script to execute.
- Returns:
- A new ScriptComponentBuilder.
 
- 
newScriptFileReturns a builder for creating Async Loggers.- Parameters:
- path- The location of the script file.
- Returns:
- A new ScriptFileComponentBuilder.
 
- 
newScriptFileReturns a builder for creating Async Loggers.- Parameters:
- name- The name of the script file.
- path- The location of the script file.
- Returns:
- A new ScriptFileComponentBuilder.
 
- 
newAppenderReturns a builder for creating Appenders.- Parameters:
- name- The name of the Appender.
- pluginName- The Plugin type of the Appender.
- Returns:
- A new AppenderComponentBuilder.
 
- 
newAppenderRefReturns a builder for creating AppenderRefs.- Parameters:
- ref- The name of the Appender being referenced.
- Returns:
- A new AppenderRefComponentBuilder.
 
- 
newAsyncLoggerReturns a builder for creating Async Loggers.- Parameters:
- name- The name of the Logger.
- Returns:
- A new LoggerComponentBuilder.
 
- 
newAsyncLoggerReturns a builder for creating Async Loggers.- Parameters:
- name- The name of the Logger.
- includeLocation- If true include location information.
- Returns:
- A new LoggerComponentBuilder.
 
- 
newAsyncLoggerReturns a builder for creating Async Loggers.- Parameters:
- name- The name of the Logger.
- level- The logging Level to be assigned to the Logger.
- Returns:
- A new LoggerComponentBuilder.
 
- 
newAsyncLoggerReturns a builder for creating Async Loggers.- 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.
 
- 
newAsyncLoggerReturns a builder for creating Async Loggers.- Parameters:
- name- The name of the Logger.
- level- The logging Level to be assigned to the Logger.
- Returns:
- A new LoggerComponentBuilder.
 
- 
newAsyncLoggerReturns a builder for creating Async Loggers.- 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.
 
- 
newAsyncRootLoggerRootLoggerComponentBuilder newAsyncRootLogger()Returns a builder for creating the async root Logger.- Returns:
- A new RootLoggerComponentBuilder.
 
- 
newAsyncRootLoggerReturns a builder for creating the async root Logger.- Parameters:
- includeLocation- If true include location information.
- Returns:
- A new RootLoggerComponentBuilder.
 
- 
newAsyncRootLoggerReturns a builder for creating the async root Logger.- Parameters:
- level- The logging Level to be assigned to the root Logger.
- Returns:
- A new RootLoggerComponentBuilder.
 
- 
newAsyncRootLoggerReturns a builder for creating the async root Logger.- Parameters:
- level- The logging Level to be assigned to the root Logger.
- includeLocation- If true include location information.
- Returns:
- A new RootLoggerComponentBuilder.
 
- 
newAsyncRootLoggerReturns a builder for creating the async root Logger.- Parameters:
- level- The logging Level to be assigned to the root Logger.
- Returns:
- A new RootLoggerComponentBuilder.
 
- 
newAsyncRootLoggerReturns a builder for creating the async root Logger.- Parameters:
- level- The logging Level to be assigned to the root Logger.
- includeLocation- If true include location information.
- Returns:
- A new RootLoggerComponentBuilder.
 
- 
newComponentReturns a builder for creating generic components.- Type Parameters:
- B- ComponentBuilder target type
- Parameters:
- pluginName- The Plugin type of the component.
- Returns:
- A new ComponentBuilder.
 
- 
newComponentReturns a builder for creating generic components.- Type Parameters:
- B- ComponentBuilder target type
- Parameters:
- name- The name of the component (may be null).
- pluginName- The Plugin type of the component.
- Returns:
- A new ComponentBuilder.
 
- 
newComponent<B extends ComponentBuilder<B>> ComponentBuilder<B> newComponent(String name, String pluginName, String value) Returns a builder for creating generic components.- Type Parameters:
- B- ComponentBuilder target type
- Parameters:
- name- The name of the component (may be null).
- pluginName- The Plugin type of the component.
- value- The value of the component.
- Returns:
- A new ComponentBuilder.
 
- 
newPropertyReturns a builder for creating Property:s- Parameters:
- name- The name of the property.
- value- The value of the component.
- Returns:
- A new PropertyComponentBuilder.
 
- 
newKeyValuePairReturns a builder for creating KeyValuePair:s- Parameters:
- key- The name
- value- The value
- Returns:
- A new KeyValuePairComponentBuilder.
 
- 
newCustomLevelReturns a builder for creating CustomLevels- Parameters:
- name- The name of the custom level.
- level- The integer value to be assigned to the level.
- Returns:
- A new CustomLevelComponentBuilder.
 
- 
newFilterFilterComponentBuilder newFilter(String pluginName, Filter.Result onMatch, Filter.Result onMismatch) Returns a builder for creating Filters.- Parameters:
- pluginName- The Plugin type of the Filter.
- onMatch- "ACCEPT", "DENY", or "NEUTRAL"
- onMismatch- "ACCEPT", "DENY", or "NEUTRAL"
- Returns:
- A new FilterComponentBuilder.
 
- 
newFilterReturns a builder for creating Filters.- Parameters:
- pluginName- The Plugin type of the Filter.
- onMatch- "ACCEPT", "DENY", or "NEUTRAL"
- onMismatch- "ACCEPT", "DENY", or "NEUTRAL"
- Returns:
- A new FilterComponentBuilder.
 
- 
newLayoutReturns a builder for creating Layouts.- Parameters:
- pluginName- The Plugin type of the Layout.
- Returns:
- A new LayoutComponentBuilder.
 
- 
newLoggerReturns a builder for creating Loggers.- Parameters:
- name- The name of the Logger.
- Returns:
- A new LoggerComponentBuilder.
 
- 
newLoggerReturns a builder for creating Loggers.- Parameters:
- name- The name of the Logger.
- includeLocation- If true include location information.
- Returns:
- A new LoggerComponentBuilder.
 
- 
newLoggerReturns a builder for creating Loggers.- Parameters:
- name- The name of the Logger.
- level- The logging Level to be assigned to the Logger.
- Returns:
- A new LoggerComponentBuilder.
 
- 
newLoggerReturns a builder for creating Loggers.- 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.
 
- 
newLoggerReturns a builder for creating Loggers.- Parameters:
- name- The name of the Logger.
- level- The logging Level to be assigned to the Logger.
- Returns:
- A new LoggerComponentBuilder.
 
- 
newLoggerReturns a builder for creating Loggers.- 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.
 
- 
newRootLoggerRootLoggerComponentBuilder newRootLogger()Returns a builder for creating the root Logger.- Returns:
- A new RootLoggerComponentBuilder.
 
- 
newRootLoggerReturns a builder for creating the root Logger.- Parameters:
- includeLocation- If true include location information.
- Returns:
- A new RootLoggerComponentBuilder.
 
- 
newRootLoggerReturns a builder for creating the root Logger.- Parameters:
- level- The logging Level to be assigned to the root Logger.
- Returns:
- A new RootLoggerComponentBuilder.
 
- 
newRootLoggerReturns a builder for creating the root Logger.- Parameters:
- level- The logging Level to be assigned to the root Logger.
- includeLocation- If true include location information.
- Returns:
- A new RootLoggerComponentBuilder.
 
- 
newRootLoggerReturns a builder for creating the root Logger.- Parameters:
- level- The logging Level to be assigned to the root Logger.
- Returns:
- A new RootLoggerComponentBuilder.
 
- 
newRootLoggerReturns a builder for creating the root Logger.- Parameters:
- level- The logging Level to be assigned to the root Logger.
- Returns:
- A new RootLoggerComponentBuilder.
 
- 
setAdvertiserSet the Advertiser Plugin name.- Parameters:
- advertiser- The Advertiser Plugin name.
- Returns:
- this builder instance.
 
- 
setConfigurationNameSets the name of the configuration.- Parameters:
- name- the name of the- Configuration. By default is- "Constructed".
- Returns:
- this builder instance.
 
- 
setConfigurationSourceSets the configuration source, if one exists.- Parameters:
- configurationSource- the ConfigurationSource.
- Returns:
- this builder instance.
 
- 
setMonitorIntervalSets the interval at which the configuration file should be checked for changes.- Parameters:
- intervalSeconds- The number of seconds that should pass between checks of the configuration file.
- Returns:
- this builder instance.
 
- 
setPackagesSets the list of packages to search for plugins.- Parameters:
- packages- The comma separated list of packages.
- Returns:
- this builder instance.
 
- 
setShutdownHookSets whether the shutdown hook should be disabled.- Parameters:
- flag- "disable" will prevent the shutdown hook from being set.
- Returns:
- this builder instance.
 
- 
setShutdownTimeoutHow 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 ifsetShutdownHook(String)is set to "disable".)- Returns:
- this builder instance.
- See Also:
 
- 
setStatusLevelSets the level of the StatusLogger.- Parameters:
- level- The logging level.
- Returns:
- this builder instance.
 
- 
setVerbositySets whether the logging should include constructing Plugins.- Parameters:
- verbosity- "disable" will hide messages from plugin construction.
- Returns:
- this builder instance.
 
- 
setDestinationSpecifies the destination for StatusLogger events. This can beout(default) for usingstandard out,errfor 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.- Parameters:
- destination- where status log messages should be output.
- Returns:
- this builder instance.
 
- 
setLoggerContextSets the logger context.- Parameters:
- loggerContext- the logger context.
 
- 
addRootPropertyAdd the properties for the root node.- Parameters:
- key- The property key.
- value- The property value.
- Returns:
- this builder instance.
 
- 
buildBuild the configuration and optionally initialize it.- 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.
 
- 
writeXmlConfigurationConstructs an XML configuration from this builder.- Parameters:
- output- OutputStream to write to, will not be closed
- Throws:
- IOException
- Since:
- 2.7
 
- 
toXmlConfigurationString toXmlConfiguration()Constructs an XML configuration from this builder.- Returns:
- XML configuration
- Since:
- 2.7
 
 
-