Class CallLoggerRule.Builder
- Enclosing class:
- CallLoggerRule
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionprotected CallLoggerRuleCreates the bean when the bean type isnull or is the default value.disabled()Shortcut for callingenabled( .NEVER )enabled(Enablement value) Specifies whether logging is enabled when using this rule.enabledPredicate(Predicate<jakarta.servlet.http.HttpServletRequest> value) Specifies the predicate test to use when the enabled setting is set toCONDITIONALLY.exceptionFilter(Predicate<Throwable> value) Apply a throwable-based predicate check for this rule to match against.Overrides the bean returned by theBeanBuilder.build()method.The logging level to use for logging the request/response.Log a stack trace as part of the log entry.requestDetail(CallLoggingDetail value) The level of detail to log on a request.requestFilter(Predicate<jakarta.servlet.http.HttpServletRequest> value) Apply a request-based predicate check for this rule to match against.responseDetail(CallLoggingDetail value) The level of detail to log on a response.responseFilter(Predicate<jakarta.servlet.http.HttpServletResponse> value) Apply a response-based predicate check for this rule to match against.statusFilter(Predicate<Integer> value) Apply a status-based predicate check for this rule to match against.Overrides the bean type produced by theBeanBuilder.build()method.
- 
Constructor Details- 
BuilderConstructor.- Parameters:
- beanStore- The bean store to use for creating beans.
 
 
- 
- 
Method Details- 
buildDefaultDescription copied from class:BeanBuilderCreates the bean when the bean type isnull or is the default value.- Overrides:
- buildDefaultin class- BeanBuilder<CallLoggerRule>
- Returns:
- A new bean.
 
- 
statusFilterApply a status-based predicate check for this rule to match against.Example:// Create a logger rule that only matches if the status code is greater than or equal to 500. RestLogger .createRule () .statusFilter(x ->x >= 500) .build();- Parameters:
- value- The predicate check, or- null to not use any filtering based on status code.
- Returns:
- This object.
 
- 
exceptionFilterApply a throwable-based predicate check for this rule to match against.Example:// Create a logger rule that only matches if a NotFound exception was thrown. RestLogger .createRule () .exceptionFilter(x ->x instanceof NotFound) .build();This check is only performed if an actual throwable was thrown. Therefore it's not necessary to perform a null check in the predicate. - Parameters:
- value- The predicate check, or- null to not use any filtering based on exceptions.
- Returns:
- This object.
 
- 
requestFilterpublic CallLoggerRule.Builder requestFilter(Predicate<jakarta.servlet.http.HttpServletRequest> value) Apply a request-based predicate check for this rule to match against.Example:// Create a logger rule that only matches if the servlet path contains "foobar". RestLogger .createRule () .requestFilter(x ->x .getServletPath().contains("foobar" )) .build();- Parameters:
- value- The predicate check, or- null to not use any filtering based on the request.
- Returns:
- This object.
 
- 
responseFilterpublic CallLoggerRule.Builder responseFilter(Predicate<jakarta.servlet.http.HttpServletResponse> value) Apply a response-based predicate check for this rule to match against.Example:// Create a logger rule that only matches if the servlet path contains "foobar". RestLogger .createRule () .responseFilter(x ->x .getStatus() >= 500) .build();Note that the statusFilter(Predicate)andexceptionFilter(Predicate)methods are simply convenience response filters.- Parameters:
- value- The predicate check, or- null to not use any filtering based on the response.
- Returns:
- This object.
 
- 
enabledSpecifies whether logging is enabled when using this rule.Example:// Create a logger rule where logging is only enabled if the query string contains "foobar". RestLogger .createRule () .enabled(CONDITIONALLY ) .enabledPredicate(x ->x .getQueryString().contains("foobar" )) .build();- ALWAYS- Logging is enabled.
- NEVER- Logging is disabled.
- CONDITIONALLY- Logging is enabled if it passes the- enabledPredicate(Predicate)test.
 - Parameters:
- value- The enablement flag value, or- null to inherit from the call logger whose default value is- ALWAYSunless overridden via a- "juneau.restCallLogger.enabled" system property or- "JUNEAU_RESTCALLLOGGER_ENABLED" environment variable.
- Returns:
- This object.
 
- 
enabledPredicatepublic CallLoggerRule.Builder enabledPredicate(Predicate<jakarta.servlet.http.HttpServletRequest> value) Specifies the predicate test to use when the enabled setting is set toCONDITIONALLY.This setting has no effect if the enablement value is not CONDITIONALLY.Example:// Create a logger rule where logging is only enabled if the query string contains "foobar". RestLogger .createRule () .enabled(CONDITIONALLY ) .enabledPredicate(x ->x .getQueryString().contains("foobar" )) .build();- Parameters:
- value- The enablement predicate test, or- null to inherit from the call logger whose default value is- x ->- false 
- Returns:
- This object.
 
- 
disabledShortcut for callingenabled( .NEVER )- Returns:
- This object.
 
- 
requestDetailThe level of detail to log on a request.- 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 inherit from the call logger.
- Returns:
- This object.
 
- 
responseDetailThe level of detail to log on a response.- 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 inherit from the call logger.
- Returns:
- This object.
 
- 
levelThe logging level to use for logging the request/response.The default value is Level.INFO.- Parameters:
- value- The new value for this property, or- null to inherit from the call logger.
- Returns:
- This object.
 
- 
logStackTraceLog a stack trace as part of the log entry.The default value is false .- Returns:
- This object.
 
- 
implDescription copied from class:BeanBuilderOverrides the bean returned by theBeanBuilder.build()method.Use this method if you want this builder to return an already-instantiated bean. - Overrides:
- implin class- BeanBuilder<CallLoggerRule>
- Parameters:
- value- The setting value.
- Returns:
- This object.
 
- 
typeDescription copied from class:BeanBuilderOverrides the bean type produced by theBeanBuilder.build()method.Use this method if you want to instantiated a bean subclass. - Overrides:
- typein class- BeanBuilder<CallLoggerRule>
- Parameters:
- value- The setting value.
- Returns:
- This object.
 
 
-