Class CallLogger.Builder

java.lang.Object
org.apache.juneau.rest.logger.CallLogger.Builder
Enclosing class:
CallLogger

public static class CallLogger.Builder extends Object
Builder class.
  • Constructor Details

    • Builder

      protected Builder(BeanStore beanStore)
      Constructor.
      Parameters:
      beanStore - The bean store to use for creating beans.
  • Method Details

    • logger

      Specifies the logger to use for logging the request.

      If not specified, the logger name is determined in the following order:

      1. "juneau.restLogger.logger" system property.
      2. "JUNEAU_RESTLOGGER_LOGGER" environment variable.
      3. "global".

      The CallLogger.getLogger() method can also be overridden to provide different logic.

      Parameters:
      value - The logger to use for logging the request.
      Returns:
      This object.
    • logger

      Specifies the logger to use for logging the request.

      Shortcut for calling logger(Logger.getLogger(value)).

      If not specified, the logger name is determined in the following order:

      1. "juneau.restLogger.logger" system property.
      2. "JUNEAU_RESTLOGGER_LOGGER" environment variable.
      3. "global".

      The CallLogger.getLogger() method can also be overridden to provide different logic.

      Parameters:
      value - The logger to use for logging the request.
      Returns:
      This object.
    • loggerOnce

      Same as logger(Logger) but only sets the value if it's currently null.
      Parameters:
      value - The logger to use for logging the request.
      Returns:
      This object.
    • thrownStore

      Specifies the thrown exception store to use for getting stack trace information (hash IDs and occurrence counts).
      Parameters:
      value - The stack trace store.
      If null, stack trace information will not be logged.
      Returns:
      This object.
    • thrownStoreOnce

      Same as thrownStore(ThrownStore) but only sets the value if it's currently null.
      Parameters:
      value - The stack trace store.
      If null, stack trace information will not be logged.
      Returns:
      This object.
    • enabled

      Specifies the default logging enablement setting.

      This specifies the default logging enablement value if not set on the first matched rule or if no rules match.

      If not specified, the setting is determined via the following:

      Parameters:
      value - The default enablement flag value. Can be null to use the default.
      Returns:
      This object.
    • enabledTest

      public CallLogger.Builder enabledTest(Predicate<jakarta.servlet.http.HttpServletRequest> value)
      Specifies the default logging enablement test predicate.

      This specifies the default logging enablement test if not set on the first matched rule or if no rules match.

      This setting has no effect if the enablement setting is not CONDITIONALLY.

      The default if not specified is x -> false (never log).

      Parameters:
      value - The default enablement flag value. Can be null to use the default.
      Returns:
      This object.
    • disabled

      Shortcut for calling enabled(NEVER).
      Returns:
      This object.
    • requestDetail

      The default level of detail to log on a request.

      This specifies the default level of request detail if not set on the first matched rule or if no rules match.

      If not specified, the setting is determined via the following:

      • STATUS_LINE - Log only the status line.
      • HEADER - Log the status line and headers.
      • ENTITY - Log the status line and headers and content if available.
      Parameters:
      value - The new value for this property, or null to use the default.
      Returns:
      This object.
    • responseDetail

      The default level of detail to log on a response.

      This specifies the default level of response detail if not set on the first matched rule or if no rules match.

      If not specified, the setting is determined via the following:

      • STATUS_LINE - Log only the status line.
      • HEADER - Log the status line and headers.
      • ENTITY - Log the status line and headers and content if available.
      Parameters:
      value - The new value for this property, or null to use the default.
      Returns:
      This object.
    • level

      public CallLogger.Builder level(Level value)
      The default logging level to use for logging the request/response.

      This specifies the default logging level if not set on the first matched rule or if no rules match.

      If not specified, the setting is determined via the following:

      Parameters:
      value - The new value for this property, or null to use the default value.
      Returns:
      This object.
    • normalRules

      Adds logging rules to use when debug mode is not enabled.

      Logging rules are matched in the order they are added. The first to match wins.

      Parameters:
      values - The logging rules to add to the list of rules.
      Returns:
      This object.
    • debugRules

      Adds logging rules to use when debug mode is enabled.

      Logging rules are matched in the order they are added. The first to match wins.

      Parameters:
      values - The logging rules to add to the list of rules.
      Returns:
      This object.
    • rules

      Shortcut for adding the same rules as normal and debug rules.

      Logging rules are matched in the order they are added. The first to match wins.

      Parameters:
      values - The logging rules to add to the list of rules.
      Returns:
      This object.
    • build

      public CallLogger build()
      Instantiates a new call logger based on the settings in this builder.
      Returns:
      A new call logger.