Interface ConfigurationBuilder<T extends Configuration>

Type Parameters:
T - The Configuration type created by this builder.
All Superinterfaces:
Builder<T>
All Known Implementing Classes:
DefaultConfigurationBuilder

public interface ConfigurationBuilder<T extends Configuration> extends Builder<T>
Interface for building logging configurations.
Since:
2.4
  • Method Details

    • add

      Adds a ScriptComponent.
      Parameters:
      builder - The ScriptComponentBuilder with all of its attributes and sub components set.
      Returns:
      this builder instance.
    • add

      Adds a ScriptFileComponent.
      Parameters:
      builder - The ScriptFileComponentBuilder with all of its attributes and sub components set.
      Returns:
      this builder instance.
    • add

      Adds an AppenderComponent.
      Parameters:
      builder - The AppenderComponentBuilder with all of its attributes and sub components set.
      Returns:
      this builder instance.
    • add

      Adds a CustomLevel component.
      Parameters:
      builder - The CustomLevelComponentBuilder with all of its attributes set.
      Returns:
      this builder instance.
    • add

      Adds a Filter component.
      Parameters:
      builder - the FilterComponentBuilder with all of its attributes and sub components set.
      Returns:
      this builder instance.
    • add

      Adds a Logger component.
      Parameters:
      builder - The LoggerComponentBuilder with all of its attributes and sub components set.
      Returns:
      this builder instance.
    • add

      Adds the root Logger component.
      Parameters:
      builder - The RootLoggerComponentBuilder with all of its attributes and sub components set.
      Returns:
      this builder instance.
    • addProperty

      ConfigurationBuilder<T> addProperty(String key, String value)
      Adds a Property key and value.
      Parameters:
      key - The property key.
      value - The property value.
      Returns:
      this builder instance.
    • newScript

      ScriptComponentBuilder newScript(String name, String language, String text)
      Returns 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.
    • newScriptFile

      ScriptFileComponentBuilder newScriptFile(String path)
      Returns a builder for creating Async Loggers.
      Parameters:
      path - The location of the script file.
      Returns:
      A new ScriptFileComponentBuilder.
    • newScriptFile

      ScriptFileComponentBuilder newScriptFile(String name, String path)
      Returns 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.
    • newAppender

      AppenderComponentBuilder newAppender(String name, String pluginName)
      Returns a builder for creating Appenders.
      Parameters:
      name - The name of the Appender.
      pluginName - The Plugin type of the Appender.
      Returns:
      A new AppenderComponentBuilder.
    • newAppenderRef

      AppenderRefComponentBuilder newAppenderRef(String ref)
      Returns a builder for creating AppenderRefs.
      Parameters:
      ref - The name of the Appender being referenced.
      Returns:
      A new AppenderRefComponentBuilder.
    • newAsyncLogger

      LoggerComponentBuilder newAsyncLogger(String name)
      Returns a builder for creating Async Loggers.
      Parameters:
      name - The name of the Logger.
      Returns:
      A new LoggerComponentBuilder.
    • newAsyncLogger

      LoggerComponentBuilder newAsyncLogger(String name, boolean includeLocation)
      Returns a builder for creating Async Loggers.
      Parameters:
      name - The name of the Logger.
      includeLocation - If true include location information.
      Returns:
      A new LoggerComponentBuilder.
    • newAsyncLogger

      LoggerComponentBuilder newAsyncLogger(String name, Level level)
      Returns 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.
    • newAsyncLogger

      LoggerComponentBuilder newAsyncLogger(String name, Level level, boolean includeLocation)
      Returns 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.
    • newAsyncLogger

      LoggerComponentBuilder newAsyncLogger(String name, String level)
      Returns 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.
    • newAsyncLogger

      LoggerComponentBuilder newAsyncLogger(String name, String level, boolean includeLocation)
      Returns 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.
    • newAsyncRootLogger

      RootLoggerComponentBuilder newAsyncRootLogger()
      Returns a builder for creating the async root Logger.
      Returns:
      A new RootLoggerComponentBuilder.
    • newAsyncRootLogger

      RootLoggerComponentBuilder newAsyncRootLogger(boolean includeLocation)
      Returns a builder for creating the async root Logger.
      Parameters:
      includeLocation - If true include location information.
      Returns:
      A new RootLoggerComponentBuilder.
    • newAsyncRootLogger

      RootLoggerComponentBuilder newAsyncRootLogger(Level level)
      Returns a builder for creating the async root Logger.
      Parameters:
      level - The logging Level to be assigned to the root Logger.
      Returns:
      A new RootLoggerComponentBuilder.
    • newAsyncRootLogger

      RootLoggerComponentBuilder newAsyncRootLogger(Level level, boolean includeLocation)
      Returns 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.
    • newAsyncRootLogger

      RootLoggerComponentBuilder newAsyncRootLogger(String level)
      Returns a builder for creating the async root Logger.
      Parameters:
      level - The logging Level to be assigned to the root Logger.
      Returns:
      A new RootLoggerComponentBuilder.
    • newAsyncRootLogger

      RootLoggerComponentBuilder newAsyncRootLogger(String level, boolean includeLocation)
      Returns 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.
    • newComponent

      <B extends ComponentBuilder<B>> ComponentBuilder<B> newComponent(String pluginName)
      Returns a builder for creating generic components.
      Type Parameters:
      B - ComponentBuilder target type
      Parameters:
      pluginName - The Plugin type of the component.
      Returns:
      A new ComponentBuilder.
    • newComponent

      <B extends ComponentBuilder<B>> ComponentBuilder<B> newComponent(String name, String pluginName)
      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.
      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.
    • newProperty

      PropertyComponentBuilder newProperty(String name, String value)
      Returns a builder for creating Property:s
      Parameters:
      name - The name of the property.
      value - The value of the component.
      Returns:
      A new PropertyComponentBuilder.
    • newKeyValuePair

      KeyValuePairComponentBuilder newKeyValuePair(String key, String value)
      Returns a builder for creating KeyValuePair:s
      Parameters:
      key - The name
      value - The value
      Returns:
      A new KeyValuePairComponentBuilder.
    • newCustomLevel

      CustomLevelComponentBuilder newCustomLevel(String name, int level)
      Returns 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.
    • newFilter

      FilterComponentBuilder 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.
    • newFilter

      FilterComponentBuilder newFilter(String pluginName, String onMatch, String 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.
    • newLayout

      LayoutComponentBuilder newLayout(String pluginName)
      Returns a builder for creating Layouts.
      Parameters:
      pluginName - The Plugin type of the Layout.
      Returns:
      A new LayoutComponentBuilder.
    • newLogger

      LoggerComponentBuilder newLogger(String name)
      Returns a builder for creating Loggers.
      Parameters:
      name - The name of the Logger.
      Returns:
      A new LoggerComponentBuilder.
    • newLogger

      LoggerComponentBuilder newLogger(String name, boolean includeLocation)
      Returns a builder for creating Loggers.
      Parameters:
      name - The name of the Logger.
      includeLocation - If true include location information.
      Returns:
      A new LoggerComponentBuilder.
    • newLogger

      LoggerComponentBuilder newLogger(String name, Level level)
      Returns 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.
    • newLogger

      LoggerComponentBuilder newLogger(String name, Level level, boolean includeLocation)
      Returns 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.
    • newLogger

      LoggerComponentBuilder newLogger(String name, String level)
      Returns 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.
    • newLogger

      LoggerComponentBuilder newLogger(String name, String level, boolean includeLocation)
      Returns 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.
    • newRootLogger

      Returns a builder for creating the root Logger.
      Returns:
      A new RootLoggerComponentBuilder.
    • newRootLogger

      RootLoggerComponentBuilder newRootLogger(boolean includeLocation)
      Returns a builder for creating the root Logger.
      Parameters:
      includeLocation - If true include location information.
      Returns:
      A new RootLoggerComponentBuilder.
    • newRootLogger

      RootLoggerComponentBuilder newRootLogger(Level level)
      Returns a builder for creating the root Logger.
      Parameters:
      level - The logging Level to be assigned to the root Logger.
      Returns:
      A new RootLoggerComponentBuilder.
    • newRootLogger

      RootLoggerComponentBuilder newRootLogger(Level level, boolean includeLocation)
      Returns 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.
    • newRootLogger

      RootLoggerComponentBuilder newRootLogger(String level)
      Returns a builder for creating the root Logger.
      Parameters:
      level - The logging Level to be assigned to the root Logger.
      Returns:
      A new RootLoggerComponentBuilder.
    • newRootLogger

      RootLoggerComponentBuilder newRootLogger(String level, boolean includeLocation)
      Returns a builder for creating the root Logger.
      Parameters:
      level - The logging Level to be assigned to the root Logger.
      Returns:
      A new RootLoggerComponentBuilder.
    • setAdvertiser

      ConfigurationBuilder<T> setAdvertiser(String advertiser)
      Set the Advertiser Plugin name.
      Parameters:
      advertiser - The Advertiser Plugin name.
      Returns:
      this builder instance.
    • setConfigurationName

      ConfigurationBuilder<T> setConfigurationName(String name)
      Sets the name of the configuration.
      Parameters:
      name - the name of the Configuration. By default is "Constructed".
      Returns:
      this builder instance.
    • setConfigurationSource

      ConfigurationBuilder<T> setConfigurationSource(ConfigurationSource configurationSource)
      Sets the configuration source, if one exists.
      Parameters:
      configurationSource - the ConfigurationSource.
      Returns:
      this builder instance.
    • setMonitorInterval

      ConfigurationBuilder<T> setMonitorInterval(String intervalSeconds)
      Sets 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.
    • setPackages

      ConfigurationBuilder<T> setPackages(String packages)
      Sets the list of packages to search for plugins.
      Parameters:
      packages - The comma separated list of packages.
      Returns:
      this builder instance.
    • setShutdownHook

      ConfigurationBuilder<T> setShutdownHook(String flag)
      Sets whether the shutdown hook should be disabled.
      Parameters:
      flag - "disable" will prevent the shutdown hook from being set.
      Returns:
      this builder instance.
    • setShutdownTimeout

      ConfigurationBuilder<T> setShutdownTimeout(long timeout, TimeUnit timeUnit)
      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 if setShutdownHook(String) is set to "disable".)
      Returns:
      this builder instance.
      See Also:
    • setStatusLevel

      ConfigurationBuilder<T> setStatusLevel(Level level)
      Sets the level of the StatusLogger.
      Parameters:
      level - The logging level.
      Returns:
      this builder instance.
    • setVerbosity

      ConfigurationBuilder<T> setVerbosity(String verbosity)
      Sets whether the logging should include constructing Plugins.
      Parameters:
      verbosity - "disable" will hide messages from plugin construction.
      Returns:
      this builder instance.
    • setDestination

      ConfigurationBuilder<T> setDestination(String destination)
      Specifies the destination for StatusLogger events. This can be 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.
      Parameters:
      destination - where status log messages should be output.
      Returns:
      this builder instance.
    • setLoggerContext

      void setLoggerContext(LoggerContext loggerContext)
      Sets the logger context.
      Parameters:
      loggerContext - the logger context.
    • addRootProperty

      ConfigurationBuilder<T> addRootProperty(String key, String value)
      Add the properties for the root node.
      Parameters:
      key - The property key.
      value - The property value.
      Returns:
      this builder instance.
    • build

      T build(boolean initialize)
      Build 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.
    • writeXmlConfiguration

      void writeXmlConfiguration(OutputStream output) throws IOException
      Constructs an XML configuration from this builder.
      Parameters:
      output - OutputStream to write to, will not be closed
      Throws:
      IOException
      Since:
      2.7
    • toXmlConfiguration

      String toXmlConfiguration()
      Constructs an XML configuration from this builder.
      Returns:
      XML configuration
      Since:
      2.7