Class LoggingClientBuilder
java.lang.Object
com.linecorp.armeria.common.logging.LoggingDecoratorBuilder
com.linecorp.armeria.client.logging.LoggingClientBuilder
public final class LoggingClientBuilder extends LoggingDecoratorBuilder
Builds a new
LoggingClient
.-
Method Summary
Modifier and Type Method Description LoggingClient
build(HttpClient delegate)
Returns a newly-createdLoggingClient
decoratingdelegate
based on the properties of this builder.LoggingClientBuilder
contentSanitizer(BiFunction<? super RequestContext,Object,?> contentSanitizer)
Sets theBiFunction
to use to sanitize request and response content before logging.LoggingClientBuilder
contentSanitizer(Function<Object,?> contentSanitizer)
Deprecated.LoggingClientBuilder
failureResponseLogLevel(LogLevel failedResponseLogLevel)
Sets theLogLevel
to use when logging failure responses (e.g., failed with an exception).LoggingClientBuilder
headersSanitizer(BiFunction<? super RequestContext,? super HttpHeaders,?> headersSanitizer)
Sets theBiFunction
to use to sanitize request, response and trailers before logging.LoggingClientBuilder
headersSanitizer(Function<? super HttpHeaders,?> headersSanitizer)
Deprecated.LoggingClientBuilder
logger(Logger logger)
Sets theLogger
to use when logging.Function<? super HttpClient,LoggingClient>
newDecorator()
Returns a newly-createdLoggingClient
decorator based on the properties of this builder.LoggingClientBuilder
requestContentSanitizer(BiFunction<? super RequestContext,Object,?> requestContentSanitizer)
Sets theBiFunction
to use to sanitize request content before logging.LoggingClientBuilder
requestContentSanitizer(Function<Object,?> requestContentSanitizer)
Deprecated.LoggingClientBuilder
requestHeadersSanitizer(BiFunction<? super RequestContext,? super HttpHeaders,?> requestHeadersSanitizer)
Sets theBiFunction
to use to sanitize request headers before logging.LoggingClientBuilder
requestHeadersSanitizer(Function<? super HttpHeaders,?> requestHeadersSanitizer)
Deprecated.LoggingClientBuilder
requestLogLevel(LogLevel requestLogLevel)
Sets theLogLevel
to use when logging requests.LoggingClientBuilder
requestLogLevelMapper(Function<? super RequestOnlyLog,LogLevel> requestLogLevelMapper)
Sets theFunction
to use when mapping the log level of request logs.LoggingClientBuilder
requestTrailersSanitizer(BiFunction<? super RequestContext,? super HttpHeaders,?> requestTrailersSanitizer)
Sets theBiFunction
to use to sanitize request trailers before logging.LoggingClientBuilder
requestTrailersSanitizer(Function<? super HttpHeaders,?> requestTrailersSanitizer)
Deprecated.LoggingClientBuilder
responseCauseSanitizer(BiFunction<? super RequestContext,? super Throwable,?> responseCauseSanitizer)
Sets theBiFunction
to use to sanitize a response cause before logging.LoggingClientBuilder
responseCauseSanitizer(Function<? super Throwable,?> responseCauseSanitizer)
Deprecated.LoggingClientBuilder
responseContentSanitizer(BiFunction<? super RequestContext,Object,?> responseContentSanitizer)
Sets theBiFunction
to use to sanitize response content before logging.LoggingClientBuilder
responseContentSanitizer(Function<Object,?> responseContentSanitizer)
Deprecated.LoggingClientBuilder
responseHeadersSanitizer(BiFunction<? super RequestContext,? super HttpHeaders,?> responseHeadersSanitizer)
Sets theBiFunction
to use to sanitize response headers before logging.LoggingClientBuilder
responseHeadersSanitizer(Function<? super HttpHeaders,?> responseHeadersSanitizer)
Deprecated.LoggingClientBuilder
responseLogLevelMapper(Function<? super RequestLog,LogLevel> responseLogLevelMapper)
Sets theFunction
to use when mapping the log level of response logs.LoggingClientBuilder
responseTrailersSanitizer(BiFunction<? super RequestContext,? super HttpHeaders,?> responseTrailersSanitizer)
Sets theBiFunction
to use to sanitize response trailers before logging.LoggingClientBuilder
responseTrailersSanitizer(Function<? super HttpHeaders,?> responseTrailersSanitizer)
Deprecated.LoggingClientBuilder
sampler(Sampler<? super ClientRequestContext> sampler)
Sets theSampler
that determines which request needs logging.LoggingClientBuilder
samplingRate(float samplingRate)
Sets the rate at which to sample requests to log.LoggingClientBuilder
successfulResponseLogLevel(LogLevel successfulResponseLogLevel)
Sets theLogLevel
to use when logging successful responses (e.g., no unhandled exception).Methods inherited from class com.linecorp.armeria.common.logging.LoggingDecoratorBuilder
logger, requestContentSanitizer, requestHeadersSanitizer, requestLogLevelMapper, requestTrailersSanitizer, responseCauseSanitizer, responseContentSanitizer, responseHeadersSanitizer, responseLogLevelMapper, responseTrailersSanitizer, toString
-
Method Details
-
build
Returns a newly-createdLoggingClient
decoratingdelegate
based on the properties of this builder. -
newDecorator
Returns a newly-createdLoggingClient
decorator based on the properties of this builder. -
samplingRate
Sets the rate at which to sample requests to log. Any number between0.0
and1.0
will cause a random sample of the requests to be logged. -
sampler
Sets theSampler
that determines which request needs logging. -
logger
Description copied from class:LoggingDecoratorBuilder
- Overrides:
logger
in classLoggingDecoratorBuilder
-
requestLogLevel
Description copied from class:LoggingDecoratorBuilder
Sets theLogLevel
to use when logging requests. If unset, will useLogLevel.DEBUG
.- Overrides:
requestLogLevel
in classLoggingDecoratorBuilder
-
successfulResponseLogLevel
Description copied from class:LoggingDecoratorBuilder
Sets theLogLevel
to use when logging successful responses (e.g., no unhandled exception). If unset, will useLogLevel.DEBUG
.- Overrides:
successfulResponseLogLevel
in classLoggingDecoratorBuilder
-
failureResponseLogLevel
Description copied from class:LoggingDecoratorBuilder
Sets theLogLevel
to use when logging failure responses (e.g., failed with an exception). If unset, will useLogLevel.WARN
. The request will be logged too if it was not otherwise.- Overrides:
failureResponseLogLevel
in classLoggingDecoratorBuilder
-
requestLogLevelMapper
public LoggingClientBuilder requestLogLevelMapper(Function<? super RequestOnlyLog,LogLevel> requestLogLevelMapper)Description copied from class:LoggingDecoratorBuilder
Sets theFunction
to use when mapping the log level of request logs.- Overrides:
requestLogLevelMapper
in classLoggingDecoratorBuilder
-
responseLogLevelMapper
public LoggingClientBuilder responseLogLevelMapper(Function<? super RequestLog,LogLevel> responseLogLevelMapper)Description copied from class:LoggingDecoratorBuilder
Sets theFunction
to use when mapping the log level of response logs.- Overrides:
responseLogLevelMapper
in classLoggingDecoratorBuilder
-
requestHeadersSanitizer
public LoggingClientBuilder requestHeadersSanitizer(BiFunction<? super RequestContext,? super HttpHeaders,?> requestHeadersSanitizer)Description copied from class:LoggingDecoratorBuilder
Sets theBiFunction
to use to sanitize request headers before logging. It is common to have theBiFunction
that removes sensitive headers, likeCookie
, before logging. If unset, will not sanitize request headers.- Overrides:
requestHeadersSanitizer
in classLoggingDecoratorBuilder
-
requestHeadersSanitizer
@Deprecated public LoggingClientBuilder requestHeadersSanitizer(Function<? super HttpHeaders,?> requestHeadersSanitizer)Deprecated.Description copied from class:LoggingDecoratorBuilder
Sets theFunction
to use to sanitize request headers before logging. It is common to have theFunction
that removes sensitive headers, likeCookie
, before logging. If unset, will useFunction.identity()
.- Overrides:
requestHeadersSanitizer
in classLoggingDecoratorBuilder
-
responseHeadersSanitizer
public LoggingClientBuilder responseHeadersSanitizer(BiFunction<? super RequestContext,? super HttpHeaders,?> responseHeadersSanitizer)Description copied from class:LoggingDecoratorBuilder
Sets theBiFunction
to use to sanitize response headers before logging. It is common to have theBiFunction
that removes sensitive headers, likeSet-Cookie
, before logging. If unset, will not sanitize response headers.- Overrides:
responseHeadersSanitizer
in classLoggingDecoratorBuilder
-
responseHeadersSanitizer
@Deprecated public LoggingClientBuilder responseHeadersSanitizer(Function<? super HttpHeaders,?> responseHeadersSanitizer)Deprecated.Description copied from class:LoggingDecoratorBuilder
Sets theFunction
to use to sanitize response headers before logging. It is common to have theFunction
that removes sensitive headers, likeSet-Cookie
, before logging. If unset, will useFunction.identity()
.- Overrides:
responseHeadersSanitizer
in classLoggingDecoratorBuilder
-
requestTrailersSanitizer
public LoggingClientBuilder requestTrailersSanitizer(BiFunction<? super RequestContext,? super HttpHeaders,?> requestTrailersSanitizer)Description copied from class:LoggingDecoratorBuilder
Sets theBiFunction
to use to sanitize request trailers before logging. If unset, will not sanitize request trailers.- Overrides:
requestTrailersSanitizer
in classLoggingDecoratorBuilder
-
requestTrailersSanitizer
@Deprecated public LoggingClientBuilder requestTrailersSanitizer(Function<? super HttpHeaders,?> requestTrailersSanitizer)Deprecated.Description copied from class:LoggingDecoratorBuilder
Sets theFunction
to use to sanitize request trailers before logging. If unset, will useFunction.identity()
.- Overrides:
requestTrailersSanitizer
in classLoggingDecoratorBuilder
-
responseTrailersSanitizer
public LoggingClientBuilder responseTrailersSanitizer(BiFunction<? super RequestContext,? super HttpHeaders,?> responseTrailersSanitizer)Description copied from class:LoggingDecoratorBuilder
Sets theBiFunction
to use to sanitize response trailers before logging. If unset, will not sanitize response trailers.- Overrides:
responseTrailersSanitizer
in classLoggingDecoratorBuilder
-
responseTrailersSanitizer
@Deprecated public LoggingClientBuilder responseTrailersSanitizer(Function<? super HttpHeaders,?> responseTrailersSanitizer)Deprecated.Description copied from class:LoggingDecoratorBuilder
Sets theFunction
to use to sanitize response trailers before logging. If unset, will useFunction.identity()
.- Overrides:
responseTrailersSanitizer
in classLoggingDecoratorBuilder
-
headersSanitizer
public LoggingClientBuilder headersSanitizer(BiFunction<? super RequestContext,? super HttpHeaders,?> headersSanitizer)Description copied from class:LoggingDecoratorBuilder
Sets theBiFunction
to use to sanitize request, response and trailers before logging. It is common to have theBiFunction
that removes sensitive headers, like"Cookie"
and"Set-Cookie"
, before logging. This method is a shortcut for:builder.requestHeadersSanitizer(headersSanitizer); builder.requestTrailersSanitizer(headersSanitizer); builder.responseHeadersSanitizer(headersSanitizer); builder.responseTrailersSanitizer(headersSanitizer);
- Overrides:
headersSanitizer
in classLoggingDecoratorBuilder
- See Also:
LoggingDecoratorBuilder.requestHeadersSanitizer(BiFunction)
,LoggingDecoratorBuilder.requestTrailersSanitizer(BiFunction)
,LoggingDecoratorBuilder.responseHeadersSanitizer(BiFunction)
,LoggingDecoratorBuilder.responseTrailersSanitizer(BiFunction)
-
headersSanitizer
@Deprecated public LoggingClientBuilder headersSanitizer(Function<? super HttpHeaders,?> headersSanitizer)Deprecated.Description copied from class:LoggingDecoratorBuilder
Sets theFunction
to use to sanitize request, response and trailers before logging. It is common to have theFunction
that removes sensitive headers, like"Cookie"
and"Set-Cookie"
, before logging. This method is a shortcut for:builder.requestHeadersSanitizer(headersSanitizer); builder.requestTrailersSanitizer(headersSanitizer); builder.responseHeadersSanitizer(headersSanitizer); builder.responseTrailersSanitizer(headersSanitizer);
- Overrides:
headersSanitizer
in classLoggingDecoratorBuilder
- See Also:
LoggingDecoratorBuilder.requestHeadersSanitizer(Function)
,LoggingDecoratorBuilder.requestTrailersSanitizer(Function)
,LoggingDecoratorBuilder.responseHeadersSanitizer(Function)
,LoggingDecoratorBuilder.responseTrailersSanitizer(Function)
-
requestContentSanitizer
public LoggingClientBuilder requestContentSanitizer(BiFunction<? super RequestContext,Object,?> requestContentSanitizer)Description copied from class:LoggingDecoratorBuilder
Sets theBiFunction
to use to sanitize request content before logging. It is common to have theBiFunction
that removes sensitive content, such as an GPS location query, before logging. If unset, will not sanitize request content.- Overrides:
requestContentSanitizer
in classLoggingDecoratorBuilder
-
requestContentSanitizer
@Deprecated public LoggingClientBuilder requestContentSanitizer(Function<Object,?> requestContentSanitizer)Deprecated.Description copied from class:LoggingDecoratorBuilder
Sets theFunction
to use to sanitize request content before logging. It is common to have theFunction
that removes sensitive content, such as an GPS location query, before logging. If unset, will useFunction.identity()
.- Overrides:
requestContentSanitizer
in classLoggingDecoratorBuilder
-
responseContentSanitizer
public LoggingClientBuilder responseContentSanitizer(BiFunction<? super RequestContext,Object,?> responseContentSanitizer)Description copied from class:LoggingDecoratorBuilder
Sets theBiFunction
to use to sanitize response content before logging. It is common to have theBiFunction
that removes sensitive content, such as an address, before logging. If unset, will not sanitize response content.- Overrides:
responseContentSanitizer
in classLoggingDecoratorBuilder
-
responseContentSanitizer
@Deprecated public LoggingClientBuilder responseContentSanitizer(Function<Object,?> responseContentSanitizer)Deprecated.Description copied from class:LoggingDecoratorBuilder
Sets theFunction
to use to sanitize response content before logging. It is common to have theFunction
that removes sensitive content, such as an address, before logging. If unset, will useFunction.identity()
.- Overrides:
responseContentSanitizer
in classLoggingDecoratorBuilder
-
contentSanitizer
public LoggingClientBuilder contentSanitizer(BiFunction<? super RequestContext,Object,?> contentSanitizer)Description copied from class:LoggingDecoratorBuilder
Sets theBiFunction
to use to sanitize request and response content before logging. It is common to have theBiFunction
that removes sensitive content, such as an GPS location query and an address, before logging. If unset, will not sanitize content. This method is a shortcut for:builder.requestContentSanitizer(contentSanitizer); builder.responseContentSanitizer(contentSanitizer);
-
contentSanitizer
Deprecated.Description copied from class:LoggingDecoratorBuilder
Sets theFunction
to use to sanitize request and response content before logging. It is common to have theFunction
that removes sensitive content, such as an GPS location query and an address, before logging. If unset, will useFunction.identity()
. This method is a shortcut for:builder.requestContentSanitizer(contentSanitizer); builder.responseContentSanitizer(contentSanitizer);
-
responseCauseSanitizer
public LoggingClientBuilder responseCauseSanitizer(BiFunction<? super RequestContext,? super Throwable,?> responseCauseSanitizer)Description copied from class:LoggingDecoratorBuilder
Sets theBiFunction
to use to sanitize a response cause before logging. You can sanitize the stack trace of the exception to remove sensitive information, or prevent from logging the stack trace completely by returningnull
in theBiFunction
. If unset, will not sanitize a response cause.- Overrides:
responseCauseSanitizer
in classLoggingDecoratorBuilder
-
responseCauseSanitizer
@Deprecated public LoggingClientBuilder responseCauseSanitizer(Function<? super Throwable,?> responseCauseSanitizer)Deprecated.Description copied from class:LoggingDecoratorBuilder
Sets theFunction
to use to sanitize a response cause before logging. You can sanitize the stack trace of the exception to remove sensitive information, or prevent from logging the stack trace completely by returningnull
in theFunction
. If unset, will useFunction.identity()
.- Overrides:
responseCauseSanitizer
in classLoggingDecoratorBuilder
-