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 Loggerprivate final TracingLogger.Levelprivate final TracingInfoFields 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 TypeMethodDescriptionvoidStores collected tracing messages to response HTTP header.private static StringformatInstance(Object instance) Format info of instance.private static voidformatInstance(Object instance, StringBuilder textSB) Basic format of instance - just class name and identity hash code.private static voidformatResponse(javax.ws.rs.core.Response response, StringBuilder textSB) Format of response - status code, status family, reason phrase and info about entity.private static StringformatStatusInfo(javax.ws.rs.core.Response.StatusType statusInfo) private booleanisEnabled(TracingLogger.Level level) booleanisLogEnabled(TracingLogger.Event event) Test if a tracing support is enabled (according topropertiesDelegatesetting) and ifeventcan be logged (according toevent.leveland threshold level set).voidlog(TracingLogger.Event event, Object... args) Try to log event according to event level and request context threshold level setting.voidlogDuration(TracingLogger.Event event, long fromTimestamp, Object... args) Try to log event according to event level and request context threshold level setting.private voidlogImpl(TracingLogger.Event event, long duration, Object... messageArgs) Log message for specified event type.longtimestamp(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:TracingLoggerTest if a tracing support is enabled (according topropertiesDelegatesetting) and ifeventcan be logged (according toevent.leveland threshold level set).- Specified by:
isLogEnabledin classTracingLogger- Parameters:
event- event type to be tested- Returns:
trueifeventcan be logged
-
log
Description copied from class:TracingLoggerTry to log event according to event level and request context threshold level setting.- Specified by:
login classTracingLogger- Parameters:
event- event type to be loggedargs- message arguments (in relation to.Event#messageFormat()
-
logDuration
Description copied from class:TracingLoggerTry 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. IffromTimestampis not set (i.e.-1) then duration of event is0.- Specified by:
logDurationin classTracingLogger- Parameters:
event- event type to be loggedfromTimestamp- logged event is running from the timestamp in nanos.-1in case event has no durationargs- message arguments (in relation to.Event#messageFormat()
-
timestamp
Description copied from class:TracingLoggerIf logging support is switched on for current request and event setting the method returns current timestamp in nanos.- Specified by:
timestampin classTracingLogger- Parameters:
event- event type to be logged- Returns:
- Current timestamp in nanos or
-1if tracing is not enabled
-
flush
Description copied from class:TracingLoggerStores collected tracing messages to response HTTP header.- Specified by:
flushin 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 parametermessageArgsis 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
-