public class LoggingFeature
extends java.lang.Object
implements javax.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
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
Server configurable properties:
Client configurable properties:Modifier and Type | Class and Description |
---|---|
static class |
LoggingFeature.Verbosity
Verbosity determines how detailed message will be logged. |
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
DEFAULT_LOGGER_LEVEL
Default logger level which will be used for logging request and response messages.
|
static java.lang.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 LoggingFeature.Verbosity |
DEFAULT_VERBOSITY
Default verbosity for entity logging.
|
private java.util.logging.Logger |
filterLogger |
private java.util.logging.Level |
level |
private static java.lang.String |
LOGGER_LEVEL_POSTFIX |
private static java.lang.String |
LOGGER_NAME_POSTFIX |
private static java.lang.String |
LOGGING_FEATURE_CLIENT_PREFIX |
private static java.lang.String |
LOGGING_FEATURE_COMMON_PREFIX |
static java.lang.String |
LOGGING_FEATURE_LOGGER_LEVEL
Common logger level property.
|
static java.lang.String |
LOGGING_FEATURE_LOGGER_LEVEL_CLIENT
Client logger level property.
|
static java.lang.String |
LOGGING_FEATURE_LOGGER_LEVEL_SERVER
Server logger level property.
|
static java.lang.String |
LOGGING_FEATURE_LOGGER_NAME
Common logger name property.
|
static java.lang.String |
LOGGING_FEATURE_LOGGER_NAME_CLIENT
Client logger name property.
|
static java.lang.String |
LOGGING_FEATURE_LOGGER_NAME_SERVER
Server logger name property.
|
static java.lang.String |
LOGGING_FEATURE_MAX_ENTITY_SIZE
Common property for configuring a maximum number of bytes of entity to be logged.
|
static java.lang.String |
LOGGING_FEATURE_MAX_ENTITY_SIZE_CLIENT
Client property for configuring a maximum number of bytes of entity to be logged.
|
static java.lang.String |
LOGGING_FEATURE_MAX_ENTITY_SIZE_SERVER
Server property for configuring a maximum number of bytes of entity to be logged.
|
private static java.lang.String |
LOGGING_FEATURE_SERVER_PREFIX |
static java.lang.String |
LOGGING_FEATURE_VERBOSITY
Common property for configuring a verbosity of entity.
|
static java.lang.String |
LOGGING_FEATURE_VERBOSITY_CLIENT
Client property for configuring a verbosity of entity.
|
static java.lang.String |
LOGGING_FEATURE_VERBOSITY_SERVER
Server property for configuring a verbosity of entity.
|
private static java.lang.String |
MAX_ENTITY_POSTFIX |
private java.lang.Integer |
maxEntitySize |
private LoggingFeature.Verbosity |
verbosity |
private static java.lang.String |
VERBOSITY_POSTFIX |
Constructor and Description |
---|
LoggingFeature()
Creates the feature with default values.
|
LoggingFeature(java.util.logging.Logger logger)
Creates the feature with custom logger.
|
LoggingFeature(java.util.logging.Logger logger,
java.lang.Integer maxEntitySize)
Creates the feature with custom logger and maximum number of bytes of entity to log.
|
LoggingFeature(java.util.logging.Logger logger,
java.util.logging.Level level,
LoggingFeature.Verbosity verbosity,
java.lang.Integer maxEntitySize)
Creates the feature with custom logger, it's level, message verbosity and maximum number of bytes of entity to log.
|
LoggingFeature(java.util.logging.Logger logger,
LoggingFeature.Verbosity verbosity)
Creates the feature with custom logger and verbosity.
|
Modifier and Type | Method and Description |
---|---|
boolean |
configure(javax.ws.rs.core.FeatureContext context) |
private LoggingInterceptor |
createLoggingFilter(javax.ws.rs.core.FeatureContext context,
javax.ws.rs.RuntimeType runtimeType) |
public static final java.lang.String DEFAULT_LOGGER_NAME
public static final java.lang.String DEFAULT_LOGGER_LEVEL
public static final int DEFAULT_MAX_ENTITY_SIZE
public static final LoggingFeature.Verbosity DEFAULT_VERBOSITY
LoggingFeature.Verbosity
.private static final java.lang.String LOGGER_NAME_POSTFIX
private static final java.lang.String LOGGER_LEVEL_POSTFIX
private static final java.lang.String VERBOSITY_POSTFIX
private static final java.lang.String MAX_ENTITY_POSTFIX
private static final java.lang.String LOGGING_FEATURE_COMMON_PREFIX
public static final java.lang.String LOGGING_FEATURE_LOGGER_NAME
public static final java.lang.String LOGGING_FEATURE_LOGGER_LEVEL
public static final java.lang.String LOGGING_FEATURE_VERBOSITY
public static final java.lang.String LOGGING_FEATURE_MAX_ENTITY_SIZE
private static final java.lang.String LOGGING_FEATURE_SERVER_PREFIX
public static final java.lang.String LOGGING_FEATURE_LOGGER_NAME_SERVER
public static final java.lang.String LOGGING_FEATURE_LOGGER_LEVEL_SERVER
public static final java.lang.String LOGGING_FEATURE_VERBOSITY_SERVER
public static final java.lang.String LOGGING_FEATURE_MAX_ENTITY_SIZE_SERVER
private static final java.lang.String LOGGING_FEATURE_CLIENT_PREFIX
public static final java.lang.String LOGGING_FEATURE_LOGGER_NAME_CLIENT
public static final java.lang.String LOGGING_FEATURE_LOGGER_LEVEL_CLIENT
public static final java.lang.String LOGGING_FEATURE_VERBOSITY_CLIENT
public static final java.lang.String LOGGING_FEATURE_MAX_ENTITY_SIZE_CLIENT
private final java.util.logging.Logger filterLogger
private final LoggingFeature.Verbosity verbosity
private final java.lang.Integer maxEntitySize
private final java.util.logging.Level level
public LoggingFeature()
public LoggingFeature(java.util.logging.Logger logger)
logger
- the logger to log requests and responses.public LoggingFeature(java.util.logging.Logger logger, LoggingFeature.Verbosity verbosity)
logger
- the logger to log requests and responses.verbosity
- verbosity of logged messages. See LoggingFeature.Verbosity
.public LoggingFeature(java.util.logging.Logger logger, java.lang.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(java.util.logging.Logger logger, java.util.logging.Level level, LoggingFeature.Verbosity verbosity, java.lang.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 boolean configure(javax.ws.rs.core.FeatureContext context)
configure
in interface javax.ws.rs.core.Feature
private LoggingInterceptor createLoggingFilter(javax.ws.rs.core.FeatureContext context, javax.ws.rs.RuntimeType runtimeType)