Class TracingLogger.TracingLoggerImpl
java.lang.Object
org.glassfish.jersey.message.internal.TracingLogger
org.glassfish.jersey.message.internal.TracingLogger.TracingLoggerImpl
- Enclosing class:
TracingLogger
Real implementation of tracing logger.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.glassfish.jersey.message.internal.TracingLogger
TracingLogger.Event, TracingLogger.Level
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Logger
private final TracingLogger.Level
private final TracingInfo
Fields inherited from class org.glassfish.jersey.message.internal.TracingLogger
DEFAULT_LEVEL, HEADER_ACCEPT, HEADER_LOGGER, HEADER_THRESHOLD, PROPERTY_NAME
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Stores collected tracing messages to response HTTP header.private static String
formatInstance
(Object instance) Format info of instance.private static void
formatInstance
(Object instance, StringBuilder textSB) Basic format of instance - just class name and identity hash code.private static void
formatResponse
(javax.ws.rs.core.Response response, StringBuilder textSB) Format of response - status code, status family, reason phrase and info about entity.private static String
formatStatusInfo
(javax.ws.rs.core.Response.StatusType statusInfo) private boolean
isEnabled
(TracingLogger.Level level) boolean
isLogEnabled
(TracingLogger.Event event) Test if a tracing support is enabled (according topropertiesDelegate
setting) and ifevent
can be logged (according toevent.level
and threshold level set).void
log
(TracingLogger.Event event, Object... args) Try to log event according to event level and request context threshold level setting.void
logDuration
(TracingLogger.Event event, long fromTimestamp, Object... args) Try to log event according to event level and request context threshold level setting.private void
logImpl
(TracingLogger.Event event, long duration, Object... messageArgs) Log message for specified event type.long
timestamp
(TracingLogger.Event event) If logging support is switched on for current request and event setting the method returns current timestamp in nanos.Methods inherited from class org.glassfish.jersey.message.internal.TracingLogger
create, empty, getInstance
-
Field Details
-
logger
-
threshold
-
tracingInfo
-
-
Constructor Details
-
TracingLoggerImpl
-
-
Method Details
-
isLogEnabled
Description copied from class:TracingLogger
Test if a tracing support is enabled (according topropertiesDelegate
setting) and ifevent
can be logged (according toevent.level
and threshold level set).- Specified by:
isLogEnabled
in classTracingLogger
- Parameters:
event
- event type to be tested- Returns:
true
ifevent
can be logged
-
log
Description copied from class:TracingLogger
Try to log event according to event level and request context threshold level setting.- Specified by:
log
in classTracingLogger
- Parameters:
event
- event type to be loggedargs
- message arguments (in relation to.Event#messageFormat()
-
logDuration
Description copied from class:TracingLogger
Try to log event according to event level and request context threshold level setting. If logging support is switched on for current request and event setting the method computes duration of event and log message. IffromTimestamp
is not set (i.e.-1
) then duration of event is0
.- Specified by:
logDuration
in classTracingLogger
- Parameters:
event
- event type to be loggedfromTimestamp
- logged event is running from the timestamp in nanos.-1
in case event has no durationargs
- message arguments (in relation to.Event#messageFormat()
-
timestamp
Description copied from class:TracingLogger
If logging support is switched on for current request and event setting the method returns current timestamp in nanos.- Specified by:
timestamp
in classTracingLogger
- Parameters:
event
- event type to be logged- Returns:
- Current timestamp in nanos or
-1
if tracing is not enabled
-
flush
Description copied from class:TracingLogger
Stores collected tracing messages to response HTTP header.- Specified by:
flush
in classTracingLogger
- Parameters:
headers
- message headers.
-
logImpl
Log message for specified event type. The event contains name, category, level and also message format. Message format will be formatted by parametermessageArgs
is used to format event. If there is no message format then each message arg is separated by space. Final message also contains event name (JDK Log) or category (HTTP header) and time stamp.- Parameters:
event
- Event type of logduration
- Time duration of logged event. Can be0
.messageArgs
- message arguments
-
isEnabled
-
formatInstance
Format info of instance. It shows its class name, identity hash code, and following info if available: priority value, response detail.- Parameters:
instance
- instance to be formatted- Returns:
- Formatted info of instance.
-
formatInstance
Basic format of instance - just class name and identity hash code.- Parameters:
instance
- instance to be formattedtextSB
- Formatted info will be appended toStringBuilder
-
formatResponse
Format of response - status code, status family, reason phrase and info about entity.- Parameters:
response
- response to be formattedtextSB
- Formatted info will be appended toStringBuilder
-
formatStatusInfo
-