Class LoggingDecoratorBuilder
java.lang.Object
com.linecorp.armeria.common.logging.LoggingDecoratorBuilder
- Direct Known Subclasses:
LoggingClientBuilder
,LoggingRpcClientBuilder
,LoggingServiceBuilder
Builds a new logging decorator.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptioncontentSanitizer
(BiFunction<? super RequestContext, Object, ? extends @Nullable Object> contentSanitizer) Deprecated.protected LoggingDecoratorBuilder
defaultLogger
(Logger logger) Sets the logger that is used when neitherlogWriter(LogWriter)
norlogger(Logger)
is set.failureResponseLogLevel
(LogLevel failedResponseLogLevel) Deprecated.UseLogWriterBuilder.failureResponseLogLevel(LogLevel)
instead.headersSanitizer
(BiFunction<? super RequestContext, ? super HttpHeaders, ? extends @Nullable Object> headersSanitizer) Deprecated.UseLogFormatter
to set the sanitizer.logger()
Returns theLogger
the user specified to use, ornull
if not set and a default logger should be used.Deprecated.UseLogWriterBuilder.logger(String)
instead.Deprecated.UseLogWriterBuilder.logger(Logger)
instead.protected final LogWriter
ReturnsLogWriter
if set.protected final BiFunction<? super RequestContext,
Object, ? extends @Nullable Object> Returns theBiFunction
to use to sanitize request content before logging.requestContentSanitizer
(BiFunction<? super RequestContext, Object, ? extends @Nullable Object> requestContentSanitizer) Deprecated.UseLogFormatter
to set the sanitizer.protected final BiFunction<? super RequestContext,
? super HttpHeaders, ? extends @Nullable Object> Returns theBiFunction
to use to sanitize request headers before logging.requestHeadersSanitizer
(BiFunction<? super RequestContext, ? super HttpHeaders, ? extends @Nullable Object> requestHeadersSanitizer) Deprecated.UseLogFormatter
to set the sanitizer.requestLogLevel
(LogLevel requestLogLevel) Deprecated.UseLogWriterBuilder.requestLogLevel(LogLevel)
instead.requestLogLevel
(Class<? extends Throwable> clazz, LogLevel requestLogLevel) Deprecated.UseLogWriterBuilder.requestLogLevel(Class, LogLevel)
instead.protected final RequestLogLevelMapper
Returns theRequestLogLevelMapper
to use when logging request logs.requestLogLevelMapper
(RequestLogLevelMapper requestLogLevelMapper) Deprecated.requestLogLevelMapper
(Function<? super RequestOnlyLog, LogLevel> requestLogLevelMapper) Deprecated.UserequestLogLevelMapper(RequestLogLevelMapper)
instead.protected final BiFunction<? super RequestContext,
? super HttpHeaders, ? extends @Nullable Object> Returns theBiFunction
to use to sanitize request trailers before logging.requestTrailersSanitizer
(BiFunction<? super RequestContext, ? super HttpHeaders, ? extends @Nullable Object> requestTrailersSanitizer) Deprecated.UseLogFormatter
to set the sanitizer.responseCauseFilter
(Predicate<Throwable> responseCauseFilter) Deprecated.UseLogWriterBuilder.responseCauseFilter(Predicate)
instead.protected final BiFunction<? super RequestContext,
? super Throwable, ? extends @Nullable Object> Returns theBiFunction
to use to sanitize response cause before logging.responseCauseSanitizer
(BiFunction<? super RequestContext, ? super Throwable, ? extends @Nullable Object> responseCauseSanitizer) Deprecated.UseLogWriterBuilder.responseCauseFilter(Predicate)
instead.protected final BiFunction<? super RequestContext,
Object, ? extends @Nullable Object> Returns theBiFunction
to use to sanitize response content before logging.responseContentSanitizer
(BiFunction<? super RequestContext, Object, ? extends @Nullable Object> responseContentSanitizer) Deprecated.UseLogFormatter
to set the sanitizer.protected final BiFunction<? super RequestContext,
? super HttpHeaders, ? extends @Nullable Object> Returns theBiFunction
to use to sanitize response headers before logging.responseHeadersSanitizer
(BiFunction<? super RequestContext, ? super HttpHeaders, ? extends @Nullable Object> responseHeadersSanitizer) Deprecated.UseLogFormatter
to set the sanitizer.responseLogLevel
(HttpStatusClass statusClass, LogLevel logLevel) Deprecated.responseLogLevel
(HttpStatus status, LogLevel logLevel) Deprecated.responseLogLevel
(Class<? extends Throwable> clazz, LogLevel logLevel) Deprecated.UseLogWriterBuilder.responseLogLevel(Class, LogLevel)
instead.protected final ResponseLogLevelMapper
Returns theResponseLogLevelMapper
to use when logging response logs.responseLogLevelMapper
(ResponseLogLevelMapper responseLogLevelMapper) Deprecated.responseLogLevelMapper
(Function<? super RequestLog, LogLevel> responseLogLevelMapper) Deprecated.UseresponseLogLevelMapper(ResponseLogLevelMapper)
instead.protected final BiFunction<? super RequestContext,
? super HttpHeaders, ? extends @Nullable Object> Returns theFunction
to use to sanitize response trailers before logging.responseTrailersSanitizer
(BiFunction<? super RequestContext, ? super HttpHeaders, ? extends @Nullable Object> responseTrailersSanitizer) Deprecated.UseLogFormatter
to set the sanitizer.successfulResponseLogLevel
(LogLevel successfulResponseLogLevel) Deprecated.toString()
-
Constructor Details
-
LoggingDecoratorBuilder
public LoggingDecoratorBuilder()
-
-
Method Details
-
defaultLogger
Sets the logger that is used when neitherlogWriter(LogWriter)
norlogger(Logger)
is set. -
logger
Deprecated.UseLogWriterBuilder.logger(Logger)
instead. -
logger
Deprecated.UseLogWriterBuilder.logger(String)
instead.Sets the name of theLogger
to use when logging. This method is a shortcut forthis.logger(LoggerFactory.getLogger(loggerName))
. -
logger
Returns theLogger
the user specified to use, ornull
if not set and a default logger should be used. -
requestLogLevel
Deprecated.UseLogWriterBuilder.requestLogLevel(LogLevel)
instead.Sets theLogLevel
to use when logging requests. If unset, will useLogLevel.DEBUG
. -
requestLogLevel
@Deprecated public LoggingDecoratorBuilder requestLogLevel(Class<? extends Throwable> clazz, LogLevel requestLogLevel) Deprecated.UseLogWriterBuilder.requestLogLevel(Class, LogLevel)
instead. -
requestLogLevelMapper
@Deprecated public LoggingDecoratorBuilder requestLogLevelMapper(Function<? super RequestOnlyLog, LogLevel> requestLogLevelMapper) Deprecated.UserequestLogLevelMapper(RequestLogLevelMapper)
instead.Sets theFunction
to use when mapping the log level of request logs. -
requestLogLevelMapper
@Deprecated public LoggingDecoratorBuilder requestLogLevelMapper(RequestLogLevelMapper requestLogLevelMapper) Deprecated.Sets theRequestLogLevelMapper
to use when mapping the log level of request logs. -
requestLogLevelMapper
Returns theRequestLogLevelMapper
to use when logging request logs. -
responseLogLevel
Deprecated.Sets theLogLevel
to use when logging responses whose status is equal to the specifiedHttpStatus
. -
responseLogLevel
@Deprecated public LoggingDecoratorBuilder responseLogLevel(HttpStatusClass statusClass, LogLevel logLevel) Deprecated.Sets theLogLevel
to use when logging responses whose status belongs to the specifiedHttpStatusClass
. -
responseLogLevel
@Deprecated public LoggingDecoratorBuilder responseLogLevel(Class<? extends Throwable> clazz, LogLevel logLevel) Deprecated.UseLogWriterBuilder.responseLogLevel(Class, LogLevel)
instead. -
successfulResponseLogLevel
@Deprecated public LoggingDecoratorBuilder successfulResponseLogLevel(LogLevel successfulResponseLogLevel) Deprecated.Sets theLogLevel
to use when logging successful responses (e.g., no unhandled exception).LogLevel.DEBUG
will be used by default. -
failureResponseLogLevel
Deprecated.UseLogWriterBuilder.failureResponseLogLevel(LogLevel)
instead.Sets theLogLevel
to use when logging failure responses (e.g., failed with an exception).LogLevel.WARN
will be used by default. -
responseLogLevelMapper
@Deprecated public LoggingDecoratorBuilder responseLogLevelMapper(Function<? super RequestLog, LogLevel> responseLogLevelMapper) Deprecated.UseresponseLogLevelMapper(ResponseLogLevelMapper)
instead.Sets theFunction
to use when mapping the log level of response logs. -
responseLogLevelMapper
@Deprecated public LoggingDecoratorBuilder responseLogLevelMapper(ResponseLogLevelMapper responseLogLevelMapper) Deprecated.Sets theResponseLogLevelMapper
to use when mapping the log level of response logs. -
responseLogLevelMapper
Returns theResponseLogLevelMapper
to use when logging response logs. -
requestHeadersSanitizer
@Deprecated public LoggingDecoratorBuilder requestHeadersSanitizer(BiFunction<? super RequestContext, ? super HttpHeaders, ? extends @Nullable Object> requestHeadersSanitizer) Deprecated.UseLogFormatter
to set the sanitizer.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.- Throws:
IllegalStateException
- If both the log sanitizers and theLogFormatter
are specified.
-
requestHeadersSanitizer
protected final BiFunction<? super RequestContext,? super HttpHeaders, requestHeadersSanitizer()? extends @Nullable Object> Returns theBiFunction
to use to sanitize request headers before logging. -
responseHeadersSanitizer
@Deprecated public LoggingDecoratorBuilder responseHeadersSanitizer(BiFunction<? super RequestContext, ? super HttpHeaders, ? extends @Nullable Object> responseHeadersSanitizer) Deprecated.UseLogFormatter
to set the sanitizer.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.- Throws:
IllegalStateException
- If both the log sanitizers and theLogFormatter
are specified.
-
responseHeadersSanitizer
protected final BiFunction<? super RequestContext,? super HttpHeaders, responseHeadersSanitizer()? extends @Nullable Object> Returns theBiFunction
to use to sanitize response headers before logging. -
requestTrailersSanitizer
@Deprecated public LoggingDecoratorBuilder requestTrailersSanitizer(BiFunction<? super RequestContext, ? super HttpHeaders, ? extends @Nullable Object> requestTrailersSanitizer) Deprecated.UseLogFormatter
to set the sanitizer.Sets theBiFunction
to use to sanitize request trailers before logging. If unset, will not sanitize request trailers.- Throws:
IllegalStateException
- If both the log sanitizers and theLogFormatter
are specified.
-
requestTrailersSanitizer
protected final BiFunction<? super RequestContext,? super HttpHeaders, requestTrailersSanitizer()? extends @Nullable Object> Returns theBiFunction
to use to sanitize request trailers before logging. -
responseTrailersSanitizer
@Deprecated public LoggingDecoratorBuilder responseTrailersSanitizer(BiFunction<? super RequestContext, ? super HttpHeaders, ? extends @Nullable Object> responseTrailersSanitizer) Deprecated.UseLogFormatter
to set the sanitizer.Sets theBiFunction
to use to sanitize response trailers before logging. If unset, will not sanitize response trailers.- Throws:
IllegalStateException
- If both the log sanitizers and theLogFormatter
are specified.
-
responseTrailersSanitizer
protected final BiFunction<? super RequestContext,? super HttpHeaders, responseTrailersSanitizer()? extends @Nullable Object> Returns theFunction
to use to sanitize response trailers before logging. -
headersSanitizer
@Deprecated public LoggingDecoratorBuilder headersSanitizer(BiFunction<? super RequestContext, ? super HttpHeaders, ? extends @Nullable Object> headersSanitizer) Deprecated.UseLogFormatter
to set the sanitizer.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);
- Throws:
IllegalStateException
- If both the log sanitizers and theLogFormatter
are specified.- See Also:
-
requestContentSanitizer
@Deprecated public LoggingDecoratorBuilder requestContentSanitizer(BiFunction<? super RequestContext, Object, ? extends @Nullable Object> requestContentSanitizer) Deprecated.UseLogFormatter
to set the sanitizer.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.- Throws:
IllegalStateException
- If both the log sanitizers and theLogFormatter
are specified.
-
requestContentSanitizer
protected final BiFunction<? super RequestContext,Object, requestContentSanitizer()? extends @Nullable Object> Returns theBiFunction
to use to sanitize request content before logging. -
responseContentSanitizer
@Deprecated public LoggingDecoratorBuilder responseContentSanitizer(BiFunction<? super RequestContext, Object, ? extends @Nullable Object> responseContentSanitizer) Deprecated.UseLogFormatter
to set the sanitizer.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.- Throws:
IllegalStateException
- If both the log sanitizers and theLogFormatter
are specified.
-
responseContentSanitizer
protected final BiFunction<? super RequestContext,Object, responseContentSanitizer()? extends @Nullable Object> Returns theBiFunction
to use to sanitize response content before logging. -
contentSanitizer
@Deprecated public LoggingDecoratorBuilder contentSanitizer(BiFunction<? super RequestContext, Object, ? extends @Nullable Object> contentSanitizer) Deprecated.UseLogFormatter
to set the sanitizer.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);
- Throws:
IllegalStateException
- If both the log sanitizers and theLogFormatter
are specified.- See Also:
-
responseCauseSanitizer
@Deprecated public LoggingDecoratorBuilder responseCauseSanitizer(BiFunction<? super RequestContext, ? super Throwable, ? extends @Nullable Object> responseCauseSanitizer) Deprecated.UseLogWriterBuilder.responseCauseFilter(Predicate)
instead.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.- Throws:
IllegalStateException
- If both the log sanitizers and theLogFormatter
are specified.
-
responseCauseSanitizer
protected final BiFunction<? super RequestContext,? super Throwable, responseCauseSanitizer()? extends @Nullable Object> Returns theBiFunction
to use to sanitize response cause before logging. -
responseCauseFilter
@Deprecated public LoggingDecoratorBuilder responseCauseFilter(Predicate<Throwable> responseCauseFilter) Deprecated.UseLogWriterBuilder.responseCauseFilter(Predicate)
instead. -
logWriter
Sets theLogWriter
which write aRequestOnlyLog
orRequestLog
. By defaultLogWriter.of()
will be used.- Throws:
IllegalStateException
- If both the log sanitizers and theLogWriter
are specified.
-
logWriter
ReturnsLogWriter
if set. -
toString
-
LogFormatter
to set the sanitizer.