Package org.jboss.resteasy.tracing.api
Class RESTEasyTracing
- java.lang.Object
-
- org.jboss.resteasy.tracing.api.RESTEasyTracing
-
public abstract class RESTEasyTracing extends Object
-
-
Field Summary
Fields Modifier and Type Field Description static RESTEasyTracingLevelDEFAULT_LEVELDefault event level.protected static StringDEFAULT_LOGGER_NAME_SUFFIXDefault JDK logger name suffix.static StringHEADER_ACCEPTRequest header name to switch on request tracing.static StringHEADER_ACCEPT_FORMATRequest header name to indicate the tracing info format.static StringHEADER_LOGGERRequest header name to set JDK logger name suffix to identify a request logs.protected static StringHEADER_RESPONSE_FORMATResponse header name format.static StringHEADER_THRESHOLDRequest header name to change application default tracing level.static StringHEADER_TRACING_PREFIXHTTP header prefix.static StringPROPERTY_NAMETracingLoggerinstance is placed in request context properties under this name.protected static StringTRACING_LOGGER_NAME_PREFIXJDK logger name prefix.
-
Constructor Summary
Constructors Constructor Description RESTEasyTracing()
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description abstract booleanisLogEnabled(RESTEasyTracingEvent event)Test if a tracing support is enabled ifeventcan be logged (according to event.level and threshold level set).abstract voidlog(RESTEasyTracingEvent event, Object... args)Try to log event according to event level and request context threshold level setting.abstract voidlogDuration(RESTEasyTracingEvent event, long fromTimestamp, Object... args)Try to log event according to event level and request context threshold level setting.abstract longtimestamp(RESTEasyTracingEvent event)If logging support is switched on for current request and event setting the method returns current timestamp in nanos.
-
-
-
Field Detail
-
PROPERTY_NAME
public static final String PROPERTY_NAME
TracingLoggerinstance is placed in request context properties under this name.
-
HEADER_TRACING_PREFIX
public static final String HEADER_TRACING_PREFIX
HTTP header prefix.- See Also:
- Constant Field Values
-
HEADER_THRESHOLD
public static final String HEADER_THRESHOLD
Request header name to change application default tracing level.- See Also:
- Constant Field Values
-
HEADER_ACCEPT
public static final String HEADER_ACCEPT
Request header name to switch on request tracing. Make sense in case of tracing support enabled by ON_DEMAND value.- See Also:
- Constant Field Values
-
HEADER_ACCEPT_FORMAT
public static final String HEADER_ACCEPT_FORMAT
Request header name to indicate the tracing info format. Currently we support `TEXT` format and `JSON` format.- See Also:
- Constant Field Values
-
HEADER_LOGGER
public static final String HEADER_LOGGER
Request header name to set JDK logger name suffix to identify a request logs.- See Also:
- Constant Field Values
-
HEADER_RESPONSE_FORMAT
protected static final String HEADER_RESPONSE_FORMAT
Response header name format.- See Also:
- Constant Field Values
-
DEFAULT_LEVEL
public static final RESTEasyTracingLevel DEFAULT_LEVEL
Default event level.
-
TRACING_LOGGER_NAME_PREFIX
protected static final String TRACING_LOGGER_NAME_PREFIX
JDK logger name prefix.- See Also:
- Constant Field Values
-
DEFAULT_LOGGER_NAME_SUFFIX
protected static final String DEFAULT_LOGGER_NAME_SUFFIX
Default JDK logger name suffix. This can be overwrite by headerHEADER_LOGGER.- See Also:
- Constant Field Values
-
-
Method Detail
-
isLogEnabled
public abstract boolean isLogEnabled(RESTEasyTracingEvent event)
Test if a tracing support is enabled ifeventcan be logged (according to event.level and threshold level set).- Parameters:
event- event type to be tested- Returns:
trueifeventcan be logged
-
log
public abstract void log(RESTEasyTracingEvent event, Object... args)
Try to log event according to event level and request context threshold level setting.- Parameters:
event- event type to be loggedargs- message arguments (in relation toRESTEasyTracingEvent.messageFormat()
-
logDuration
public abstract void logDuration(RESTEasyTracingEvent event, long fromTimestamp, Object... args)
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. If
fromTimestampis not set (i.e.-1) then duration of event is0.- 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 toRESTEasyTracingEvent.messageFormat()
-
timestamp
public abstract long timestamp(RESTEasyTracingEvent event)
If logging support is switched on for current request and event setting the method returns current timestamp in nanos.- Parameters:
event- event type to be logged- Returns:
- Current timestamp in nanos or
-1if tracing is not enabled
-
-