public class LoggingFeature extends Object implements jakarta.ws.rs.core.Feature
RuntimeType
.
The feature may be register programmatically like other features by calling any of Configurable
register(...)
method, i.e. Configurable.register(Class)
or by setting any of the
configuration property listed bellow.
Common configurable properties applies for both client and server and are following:
LOGGING_FEATURE_LOGGER_NAME
LOGGING_FEATURE_LOGGER_LEVEL
LOGGING_FEATURE_VERBOSITY
LOGGING_FEATURE_MAX_ENTITY_SIZE
LOGGING_FEATURE_SEPARATOR
LOGGING_FEATURE_REDACT_HEADERS
If any of the configuration value is not set, following default values are applied:
org.glassfish.jersey.logging.LoggingFeature
Level.FINE
LoggingFeature.Verbosity.PAYLOAD_TEXT
DEFAULT_SEPARATOR
Server configurable properties:
Client configurable properties:Modifier and Type | Class and Description |
---|---|
static class |
LoggingFeature.LoggingFeatureBuilder
Builder class for logging feature configuration.
|
static class |
LoggingFeature.Verbosity
Verbosity determines how detailed message will be logged. |
Modifier and Type | Field and Description |
---|---|
static String |
DEFAULT_LOGGER_LEVEL
Default logger level which will be used for logging request and response messages.
|
static String |
DEFAULT_LOGGER_NAME
Default logger name to log request and response messages.
|
static int |
DEFAULT_MAX_ENTITY_SIZE
Default maximum entity bytes to be logged.
|
static String |
DEFAULT_REDACT_HEADERS
Default headers to be redacted.
|
static String |
DEFAULT_SEPARATOR
Default separator for entity logging.
|
static LoggingFeature.Verbosity |
DEFAULT_VERBOSITY
Default verbosity for entity logging.
|
static String |
LOGGING_FEATURE_LOGGER_LEVEL
Common logger level property.
|
static String |
LOGGING_FEATURE_LOGGER_LEVEL_CLIENT
Client logger level property.
|
static String |
LOGGING_FEATURE_LOGGER_LEVEL_SERVER
Server logger level property.
|
static String |
LOGGING_FEATURE_LOGGER_NAME
Common logger name property.
|
static String |
LOGGING_FEATURE_LOGGER_NAME_CLIENT
Client logger name property.
|
static String |
LOGGING_FEATURE_LOGGER_NAME_SERVER
Server logger name property.
|
static String |
LOGGING_FEATURE_MAX_ENTITY_SIZE
Common property for configuring a maximum number of bytes of entity to be logged.
|
static String |
LOGGING_FEATURE_MAX_ENTITY_SIZE_CLIENT
Client property for configuring a maximum number of bytes of entity to be logged.
|
static String |
LOGGING_FEATURE_MAX_ENTITY_SIZE_SERVER
Server property for configuring a maximum number of bytes of entity to be logged.
|
static String |
LOGGING_FEATURE_REDACT_HEADERS
Common property for configuring headers to be redacted.
|
static String |
LOGGING_FEATURE_REDACT_HEADERS_CLIENT
Client property for configuring headers to be redacted.
|
static String |
LOGGING_FEATURE_REDACT_HEADERS_SERVER
Server property for configuring headers to be redacted.
|
static String |
LOGGING_FEATURE_SEPARATOR
Common property for configuring logging separator.
|
static String |
LOGGING_FEATURE_SEPARATOR_CLIENT
Client property for logging separator.
|
static String |
LOGGING_FEATURE_SEPARATOR_SERVER
Server property for configuring separator.
|
static String |
LOGGING_FEATURE_VERBOSITY
Common property for configuring a verbosity of entity.
|
static String |
LOGGING_FEATURE_VERBOSITY_CLIENT
Client property for configuring a verbosity of entity.
|
static String |
LOGGING_FEATURE_VERBOSITY_SERVER
Server property for configuring a verbosity of entity.
|
Constructor and Description |
---|
LoggingFeature()
Creates the feature with default values.
|
LoggingFeature(Logger logger)
Creates the feature with custom logger.
|
LoggingFeature(Logger logger,
Integer maxEntitySize)
Creates the feature with custom logger and maximum number of bytes of entity to log.
|
LoggingFeature(Logger logger,
Level level,
LoggingFeature.Verbosity verbosity,
Integer maxEntitySize)
Creates the feature with custom logger, it's level, message verbosity and maximum number of bytes of entity to log.
|
LoggingFeature(Logger logger,
LoggingFeature.Verbosity verbosity)
Creates the feature with custom logger and verbosity.
|
LoggingFeature(LoggingFeature.LoggingFeatureBuilder builder)
Constructor based on logging feature builder.
|
Modifier and Type | Method and Description |
---|---|
static LoggingFeature.LoggingFeatureBuilder |
builder()
builder method to create LoggingFeature with required settings
|
boolean |
configure(jakarta.ws.rs.core.FeatureContext context) |
public static final String DEFAULT_LOGGER_NAME
public static final String DEFAULT_LOGGER_LEVEL
public static final int DEFAULT_MAX_ENTITY_SIZE
public static final LoggingFeature.Verbosity DEFAULT_VERBOSITY
LoggingFeature.Verbosity
.public static final String DEFAULT_SEPARATOR
public static final String DEFAULT_REDACT_HEADERS
public static final String LOGGING_FEATURE_LOGGER_NAME
public static final String LOGGING_FEATURE_LOGGER_LEVEL
public static final String LOGGING_FEATURE_VERBOSITY
public static final String LOGGING_FEATURE_MAX_ENTITY_SIZE
public static final String LOGGING_FEATURE_SEPARATOR
public static final String LOGGING_FEATURE_REDACT_HEADERS
public static final String LOGGING_FEATURE_LOGGER_NAME_SERVER
public static final String LOGGING_FEATURE_LOGGER_LEVEL_SERVER
public static final String LOGGING_FEATURE_VERBOSITY_SERVER
public static final String LOGGING_FEATURE_MAX_ENTITY_SIZE_SERVER
public static final String LOGGING_FEATURE_SEPARATOR_SERVER
public static final String LOGGING_FEATURE_REDACT_HEADERS_SERVER
public static final String LOGGING_FEATURE_LOGGER_NAME_CLIENT
public static final String LOGGING_FEATURE_LOGGER_LEVEL_CLIENT
public static final String LOGGING_FEATURE_VERBOSITY_CLIENT
public static final String LOGGING_FEATURE_MAX_ENTITY_SIZE_CLIENT
public static final String LOGGING_FEATURE_SEPARATOR_CLIENT
public static final String LOGGING_FEATURE_REDACT_HEADERS_CLIENT
public LoggingFeature()
public LoggingFeature(Logger logger)
logger
- the logger to log requests and responses.public LoggingFeature(Logger logger, LoggingFeature.Verbosity verbosity)
logger
- the logger to log requests and responses.verbosity
- verbosity of logged messages. See LoggingFeature.Verbosity
.public LoggingFeature(Logger logger, Integer maxEntitySize)
logger
- the logger to log requests and responses.maxEntitySize
- maximum number of entity bytes to be logged (and buffered) - if the entity is larger,
logging filter will print (and buffer in memory) only the specified number of bytes
and print "...more..." string at the end. Negative values are interpreted as zero.public LoggingFeature(Logger logger, Level level, LoggingFeature.Verbosity verbosity, Integer maxEntitySize)
logger
- the logger to log requests and responses.level
- level on which the messages will be logged.verbosity
- verbosity of logged messages. See LoggingFeature.Verbosity
.maxEntitySize
- maximum number of entity bytes to be logged (and buffered) - if the entity is larger,
logging filter will print (and buffer in memory) only the specified number of bytes
and print "...more..." string at the end. Negative values are interpreted as zero.public LoggingFeature(LoggingFeature.LoggingFeatureBuilder builder)
builder
- instance of a builder with required logging feature parameterspublic boolean configure(jakarta.ws.rs.core.FeatureContext context)
configure
in interface jakarta.ws.rs.core.Feature
public static LoggingFeature.LoggingFeatureBuilder builder()
Copyright © 2007-2021, Oracle and/or its affiliates. All Rights Reserved. Use is subject to license terms.