Class LoggingClientBuilder
java.lang.Object
com.linecorp.armeria.common.logging.LoggingDecoratorBuilder
com.linecorp.armeria.client.logging.LoggingClientBuilder
Builds a new
LoggingClient.-
Method Summary
Modifier and TypeMethodDescriptionbuild(HttpClient delegate) Returns a newly-createdLoggingClientdecoratingdelegatebased on the properties of this builder.contentSanitizer(BiFunction<? super RequestContext, Object, ? extends @Nullable Object> contentSanitizer) Deprecated.protected LoggingClientBuilderdefaultLogger(Logger defaultLogger) Sets the logger that is used when neitherLoggingDecoratorBuilder.logWriter(LogWriter)norLoggingDecoratorBuilder.logger(Logger)is set.failureResponseLogLevel(LogLevel failureResponseLogLevel) Deprecated.failureSampler(Sampler<? super ClientRequestContext> sampler) Sets theSamplerthat determines which failure request needs logging.failureSamplingRate(float samplingRate) Sets the rate at which to sample failure requests to log.headersSanitizer(BiFunction<? super RequestContext, ? super HttpHeaders, ? extends @Nullable Object> headersSanitizer) Deprecated.Deprecated.Deprecated.Function<? super HttpClient, LoggingClient> Returns a newly-createdLoggingClientdecorator based on the properties of this builder.requestContentSanitizer(BiFunction<? super RequestContext, Object, ? extends @Nullable Object> requestContentSanitizer) Deprecated.requestHeadersSanitizer(BiFunction<? super RequestContext, ? super HttpHeaders, ? extends @Nullable Object> requestHeadersSanitizer) Deprecated.requestLogLevel(LogLevel requestLogLevel) Deprecated.requestLogLevel(Class<? extends Throwable> clazz, LogLevel requestLogLevel) Deprecated.requestLogLevelMapper(RequestLogLevelMapper requestLogLevelMapper) Deprecated.requestLogLevelMapper(Function<? super RequestOnlyLog, LogLevel> requestLogLevelMapper) Deprecated.requestTrailersSanitizer(BiFunction<? super RequestContext, ? super HttpHeaders, ? extends @Nullable Object> requestTrailersSanitizer) Deprecated.responseCauseFilter(Predicate<Throwable> responseCauseFilter) Deprecated.responseCauseSanitizer(BiFunction<? super RequestContext, ? super Throwable, ? extends @Nullable Object> responseCauseSanitizer) Deprecated.responseContentSanitizer(BiFunction<? super RequestContext, Object, ? extends @Nullable Object> responseContentSanitizer) Deprecated.responseHeadersSanitizer(BiFunction<? super RequestContext, ? super HttpHeaders, ? extends @Nullable Object> responseHeadersSanitizer) Deprecated.responseLogLevel(HttpStatusClass statusClass, LogLevel logLevel) Deprecated.responseLogLevel(HttpStatus status, LogLevel logLevel) Deprecated.responseLogLevel(Class<? extends Throwable> clazz, LogLevel logLevel) Deprecated.responseLogLevelMapper(ResponseLogLevelMapper responseLogLevelMapper) Deprecated.responseLogLevelMapper(Function<? super RequestLog, LogLevel> responseLogLevelMapper) Deprecated.responseTrailersSanitizer(BiFunction<? super RequestContext, ? super HttpHeaders, ? extends @Nullable Object> responseTrailersSanitizer) Deprecated.sampler(Sampler<? super ClientRequestContext> sampler) Sets theSamplerthat determines which request needs logging.samplingRate(float samplingRate) Sets the rate at which to sample requests to log.successfulResponseLogLevel(LogLevel successfulResponseLogLevel) Deprecated.successSampler(Sampler<? super ClientRequestContext> sampler) Sets theSamplerthat determines which success request needs logging.successSamplingRate(float samplingRate) Sets the rate at which to sample success requests to log.Methods inherited from class com.linecorp.armeria.common.logging.LoggingDecoratorBuilder
logger, logWriter, requestContentSanitizer, requestHeadersSanitizer, requestLogLevelMapper, requestTrailersSanitizer, responseCauseSanitizer, responseContentSanitizer, responseHeadersSanitizer, responseLogLevelMapper, responseTrailersSanitizer
-
Method Details
-
build
Returns a newly-createdLoggingClientdecoratingdelegatebased on the properties of this builder. -
newDecorator
Returns a newly-createdLoggingClientdecorator based on the properties of this builder. -
defaultLogger
Description copied from class:LoggingDecoratorBuilderSets the logger that is used when neitherLoggingDecoratorBuilder.logWriter(LogWriter)norLoggingDecoratorBuilder.logger(Logger)is set.- Overrides:
defaultLoggerin classLoggingDecoratorBuilder
-
samplingRate
Sets the rate at which to sample requests to log. Any number between0.0and1.0will cause a random sample of the requests to be logged. This method sets both success and failure sampling rate. UsesuccessSamplingRate(float)andfailureSamplingRate(float)if you want to specify a different sampling rate for each case. -
sampler
Sets theSamplerthat determines which request needs logging. -
successSampler
Sets theSamplerthat determines which success request needs logging. -
successSamplingRate
Sets the rate at which to sample success requests to log. Any number between0.0and1.0will cause a random sample of the success requests to be logged. -
failureSampler
Sets theSamplerthat determines which failure request needs logging. -
failureSamplingRate
Sets the rate at which to sample failure requests to log. Any number between0.0and1.0will cause a random sample of the failure requests to be logged. -
logWriter
Description copied from class:LoggingDecoratorBuilderSets theLogWriterwhich write aRequestOnlyLogorRequestLog. By defaultLogWriter.of()will be used.- Overrides:
logWriterin classLoggingDecoratorBuilder
-
logger
Deprecated.Description copied from class:LoggingDecoratorBuilder- Overrides:
loggerin classLoggingDecoratorBuilder
-
logger
Deprecated.Description copied from class:LoggingDecoratorBuilderSets the name of theLoggerto use when logging. This method is a shortcut forthis.logger(LoggerFactory.getLogger(loggerName)).- Overrides:
loggerin classLoggingDecoratorBuilder
-
requestLogLevel
Deprecated.Description copied from class:LoggingDecoratorBuilderSets theLogLevelto use when logging requests. If unset, will useLogLevel.DEBUG.- Overrides:
requestLogLevelin classLoggingDecoratorBuilder
-
requestLogLevel
@Deprecated public LoggingClientBuilder requestLogLevel(Class<? extends Throwable> clazz, LogLevel requestLogLevel) Deprecated.Description copied from class:LoggingDecoratorBuilder- Overrides:
requestLogLevelin classLoggingDecoratorBuilder
-
requestLogLevelMapper
@Deprecated public LoggingClientBuilder requestLogLevelMapper(Function<? super RequestOnlyLog, LogLevel> requestLogLevelMapper) Deprecated.Description copied from class:LoggingDecoratorBuilderSets theFunctionto use when mapping the log level of request logs.- Overrides:
requestLogLevelMapperin classLoggingDecoratorBuilder
-
requestLogLevelMapper
@Deprecated public LoggingClientBuilder requestLogLevelMapper(RequestLogLevelMapper requestLogLevelMapper) Deprecated.Description copied from class:LoggingDecoratorBuilderSets theRequestLogLevelMapperto use when mapping the log level of request logs.- Overrides:
requestLogLevelMapperin classLoggingDecoratorBuilder
-
responseLogLevel
Deprecated.Description copied from class:LoggingDecoratorBuilderSets theLogLevelto use when logging responses whose status is equal to the specifiedHttpStatus.- Overrides:
responseLogLevelin classLoggingDecoratorBuilder
-
responseLogLevel
@Deprecated public LoggingClientBuilder responseLogLevel(HttpStatusClass statusClass, LogLevel logLevel) Deprecated.Description copied from class:LoggingDecoratorBuilderSets theLogLevelto use when logging responses whose status belongs to the specifiedHttpStatusClass.- Overrides:
responseLogLevelin classLoggingDecoratorBuilder
-
responseLogLevel
@Deprecated public LoggingClientBuilder responseLogLevel(Class<? extends Throwable> clazz, LogLevel logLevel) Deprecated.Description copied from class:LoggingDecoratorBuilder- Overrides:
responseLogLevelin classLoggingDecoratorBuilder
-
successfulResponseLogLevel
@Deprecated public LoggingClientBuilder successfulResponseLogLevel(LogLevel successfulResponseLogLevel) Deprecated.Description copied from class:LoggingDecoratorBuilderSets theLogLevelto use when logging successful responses (e.g., no unhandled exception).LogLevel.DEBUGwill be used by default.- Overrides:
successfulResponseLogLevelin classLoggingDecoratorBuilder
-
failureResponseLogLevel
Deprecated.Description copied from class:LoggingDecoratorBuilderSets theLogLevelto use when logging failure responses (e.g., failed with an exception).LogLevel.WARNwill be used by default.- Overrides:
failureResponseLogLevelin classLoggingDecoratorBuilder
-
responseLogLevelMapper
@Deprecated public LoggingClientBuilder responseLogLevelMapper(Function<? super RequestLog, LogLevel> responseLogLevelMapper) Deprecated.Description copied from class:LoggingDecoratorBuilderSets theFunctionto use when mapping the log level of response logs.- Overrides:
responseLogLevelMapperin classLoggingDecoratorBuilder
-
responseLogLevelMapper
@Deprecated public LoggingClientBuilder responseLogLevelMapper(ResponseLogLevelMapper responseLogLevelMapper) Deprecated.Description copied from class:LoggingDecoratorBuilderSets theResponseLogLevelMapperto use when mapping the log level of response logs.- Overrides:
responseLogLevelMapperin classLoggingDecoratorBuilder
-
requestHeadersSanitizer
@Deprecated public LoggingClientBuilder requestHeadersSanitizer(BiFunction<? super RequestContext, ? super HttpHeaders, ? extends @Nullable Object> requestHeadersSanitizer) Deprecated.Description copied from class:LoggingDecoratorBuilderSets theBiFunctionto use to sanitize request headers before logging. It is common to have theBiFunctionthat removes sensitive headers, likeCookie, before logging. If unset, will not sanitize request headers.- Overrides:
requestHeadersSanitizerin classLoggingDecoratorBuilder
-
responseHeadersSanitizer
@Deprecated public LoggingClientBuilder responseHeadersSanitizer(BiFunction<? super RequestContext, ? super HttpHeaders, ? extends @Nullable Object> responseHeadersSanitizer) Deprecated.Description copied from class:LoggingDecoratorBuilderSets theBiFunctionto use to sanitize response headers before logging. It is common to have theBiFunctionthat removes sensitive headers, likeSet-Cookie, before logging. If unset, will not sanitize response headers.- Overrides:
responseHeadersSanitizerin classLoggingDecoratorBuilder
-
requestTrailersSanitizer
@Deprecated public LoggingClientBuilder requestTrailersSanitizer(BiFunction<? super RequestContext, ? super HttpHeaders, ? extends @Nullable Object> requestTrailersSanitizer) Deprecated.Description copied from class:LoggingDecoratorBuilderSets theBiFunctionto use to sanitize request trailers before logging. If unset, will not sanitize request trailers.- Overrides:
requestTrailersSanitizerin classLoggingDecoratorBuilder
-
responseTrailersSanitizer
@Deprecated public LoggingClientBuilder responseTrailersSanitizer(BiFunction<? super RequestContext, ? super HttpHeaders, ? extends @Nullable Object> responseTrailersSanitizer) Deprecated.Description copied from class:LoggingDecoratorBuilderSets theBiFunctionto use to sanitize response trailers before logging. If unset, will not sanitize response trailers.- Overrides:
responseTrailersSanitizerin classLoggingDecoratorBuilder
-
headersSanitizer
@Deprecated public LoggingClientBuilder headersSanitizer(BiFunction<? super RequestContext, ? super HttpHeaders, ? extends @Nullable Object> headersSanitizer) Deprecated.Description copied from class:LoggingDecoratorBuilderSets theBiFunctionto use to sanitize request, response and trailers before logging. It is common to have theBiFunctionthat 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:
headersSanitizerin classLoggingDecoratorBuilder- See Also:
-
requestContentSanitizer
@Deprecated public LoggingClientBuilder requestContentSanitizer(BiFunction<? super RequestContext, Object, ? extends @Nullable Object> requestContentSanitizer) Deprecated.Description copied from class:LoggingDecoratorBuilderSets theBiFunctionto use to sanitize request content before logging. It is common to have theBiFunctionthat removes sensitive content, such as an GPS location query, before logging. If unset, will not sanitize request content.- Overrides:
requestContentSanitizerin classLoggingDecoratorBuilder
-
responseContentSanitizer
@Deprecated public LoggingClientBuilder responseContentSanitizer(BiFunction<? super RequestContext, Object, ? extends @Nullable Object> responseContentSanitizer) Deprecated.Description copied from class:LoggingDecoratorBuilderSets theBiFunctionto use to sanitize response content before logging. It is common to have theBiFunctionthat removes sensitive content, such as an address, before logging. If unset, will not sanitize response content.- Overrides:
responseContentSanitizerin classLoggingDecoratorBuilder
-
contentSanitizer
@Deprecated public LoggingClientBuilder contentSanitizer(BiFunction<? super RequestContext, Object, ? extends @Nullable Object> contentSanitizer) Deprecated.Description copied from class:LoggingDecoratorBuilderSets theBiFunctionto use to sanitize request and response content before logging. It is common to have theBiFunctionthat 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);- Overrides:
contentSanitizerin classLoggingDecoratorBuilder- See Also:
-
responseCauseSanitizer
@Deprecated public LoggingClientBuilder responseCauseSanitizer(BiFunction<? super RequestContext, ? super Throwable, ? extends @Nullable Object> responseCauseSanitizer) Deprecated.Description copied from class:LoggingDecoratorBuilderSets theBiFunctionto 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 returningnullin theBiFunction. If unset, will not sanitize a response cause.Note that this method is no longer supported. You must use
LogWriterBuilder.responseCauseFilter(BiPredicate).- Overrides:
responseCauseSanitizerin classLoggingDecoratorBuilder
-
responseCauseFilter
@Deprecated public LoggingClientBuilder responseCauseFilter(Predicate<Throwable> responseCauseFilter) Deprecated.Description copied from class:LoggingDecoratorBuilderSets thePredicateused for evaluating whether to log the response cause or not. You can prevent logging the response cause by returningtruein thePredicate. By default, the response cause will always be logged.- Overrides:
responseCauseFilterin classLoggingDecoratorBuilder
-