Class LoggerConfig.Builder

    • Constructor Detail

      • Builder

        public Builder()
    • Method Detail

      • fallbackToConsole

        public LoggerConfig.Builder fallbackToConsole​(boolean fallbackToConsole)
        Use the console logger instead of the java.util.logging fallback in case SLF4J is not found or disabled. Please note that in addition setting this to true, either SLF4J must not be on the classpath or manually disabled via disableSlf4J(boolean) to make it work. By default, it will log at INFO level to stdout/stderr, but the loglevel can be configured via consoleLogLevel(Level).
        Parameters:
        fallbackToConsole - true if the console logger should be used as a fallback.
        Returns:
        this LoggerConfig.Builder for chaining purposes.
      • disableSlf4J

        public LoggerConfig.Builder disableSlf4J​(boolean disableSlf4J)
        Disable SLF4J logging, which is by default the first option tried. If SLF4J is disabled, java.util.logging will be tried next, unless fallbackToConsole(boolean) is set to true.
        Parameters:
        disableSlf4J - set to true to disable SLF4J logging.
        Returns:
        this LoggerConfig.Builder for chaining purposes.
      • loggerName

        @Deprecated
        public LoggerConfig.Builder loggerName​(String loggerName)
        Deprecated.
        the logging infrastructure picks the logger name automatically now based on the event type so it is easier to enable/disable logging or change the verbosity level for certain groups rather than having a single universal logger name.
        Allowed to set a custom logger name - does not have an effect and is deprecated.
        Parameters:
        loggerName - the custom logger name.
        Returns:
        this LoggerConfig.Builder for chaining purposes.
      • enableDiagnosticContext

        public LoggerConfig.Builder enableDiagnosticContext​(boolean diagnosticContextEnabled)
        Enables the diagnostic context (if supported by the used logger) - disabled by default. Please note that this will only work for the SLF4J logger. Neither the java util logger, nor the console logger support the diagnostic context at this point. In SLF4J parlance, it is called the MDC.
        Parameters:
        diagnosticContextEnabled - if the diagnostic context should be enabled.
        Returns:
        this LoggerConfig.Builder for chaining purposes.
      • consoleLogLevel

        public LoggerConfig.Builder consoleLogLevel​(Level consoleLogLevel)
        Allows to customize the log level for the Console Logger. Please note that this DOES NOT AFFECT any other logging infrastructure (so neither the java.util.logging, nor the SLF4J setup which is the default!). It will only affect the log level if fallbackToConsole(boolean) is set to true at the same time.
        Parameters:
        consoleLogLevel - the log level for the console logger.
        Returns:
        this LoggerConfig.Builder for chaining purposes.
      • build

        public LoggerConfig build()
        Builds the LoggerConfig and makes it immutable.
        Returns:
        the built, immutable logger config.