public class DebugContext
extends java.lang.Object
Logger
wrapper that gives logging records a common formatting and temporarily stores log
records and postpones their logging until they can be provided with a session ID. After a session ID has been
provided, messages are logged immediately.
Log records are provided with a session ID, so that log records from a single upgrade request can be easily linked together in a log of a busy server or client.
Modifier and Type | Class and Description |
---|---|
static class |
DebugContext.TracingThreshold
Tracing threshold - used for configuration granularity of information that will be sent in tracing headers.
|
static class |
DebugContext.TracingType
Type of tracing - used for tracing configuration.
|
static class |
DebugContext.Type
Type of the record - used to graphically distinguish these message types in the log.
|
Constructor and Description |
---|
DebugContext()
Constructor that configures tracing to be OFF.
|
DebugContext(DebugContext.TracingThreshold tracingThreshold)
Constructor that configures tracing to be ON and accepts tracing threshold as a parameter.
|
Modifier and Type | Method and Description |
---|---|
void |
appendLogMessage(java.util.logging.Logger logger,
java.util.logging.Level loggingLevel,
DebugContext.Type type,
java.lang.Object... messageParts)
Append a message to the log, the logging will be postponed until the message can be provided with a session ID.
|
void |
appendLogMessageWithThrowable(java.util.logging.Logger logger,
java.util.logging.Level loggingLevel,
DebugContext.Type type,
java.lang.Throwable t,
java.lang.Object... messageParts)
Append a message to the log, the logging will be postponed until the message can be provided with a session ID.
|
void |
appendStandardOutputMessage(DebugContext.Type type,
java.lang.String message)
Write a message to the standard output, the logging will be postponed until the message can be provided with
a session ID.
|
void |
appendTraceMessage(java.util.logging.Logger logger,
java.util.logging.Level loggingLevel,
DebugContext.Type type,
java.lang.Object... messageParts)
Append a message to the log and to the list of trace messages that are sent in handshake response.
|
void |
appendTraceMessageWithThrowable(java.util.logging.Logger logger,
java.util.logging.Level loggingLevel,
DebugContext.Type type,
java.lang.Throwable t,
java.lang.Object... messageParts)
Append a message to the log and to the list of trace messages that are sent in handshake response.
|
void |
flush()
Write pending messages to the log.
|
java.util.Map<java.lang.String,java.util.List<java.lang.String>> |
getTracingHeaders()
Get headers containing tracing messages.
|
void |
setSessionId(java.lang.String sessionId)
Set a session ID that will be used as a common identifier for logged messages related to the same upgrade
request.
|
public DebugContext(DebugContext.TracingThreshold tracingThreshold)
tracingThreshold
- tracing threshold.public DebugContext()
public void appendLogMessage(java.util.logging.Logger logger, java.util.logging.Level loggingLevel, DebugContext.Type type, java.lang.Object... messageParts)
logger
- logger to be used to log the message.loggingLevel
- message level.type
- type of the message.messageParts
- message parts that will be concatenated to create a log message.public void appendTraceMessage(java.util.logging.Logger logger, java.util.logging.Level loggingLevel, DebugContext.Type type, java.lang.Object... messageParts)
logger
- logger to be used to log the message.loggingLevel
- message level.type
- type of the message.messageParts
- message parts that will be stringified and concatenated to create a log message.public void appendLogMessageWithThrowable(java.util.logging.Logger logger, java.util.logging.Level loggingLevel, DebugContext.Type type, java.lang.Throwable t, java.lang.Object... messageParts)
logger
- logger to be used to log the message.loggingLevel
- message level.type
- type of the message.t
- throwable that has been thrown.messageParts
- message parts that will be stringified and concatenated to create a log message.public void appendTraceMessageWithThrowable(java.util.logging.Logger logger, java.util.logging.Level loggingLevel, DebugContext.Type type, java.lang.Throwable t, java.lang.Object... messageParts)
logger
- logger to be used to log the message.loggingLevel
- message level.type
- type of the message.t
- throwable that has been thrown.messageParts
- message parts that will be stringified and concatenated to create a log message.public void appendStandardOutputMessage(DebugContext.Type type, java.lang.String message)
message
- message to be logged.type
- type of the message.public void setSessionId(java.lang.String sessionId)
sessionId
- session ID.public void flush()
public java.util.Map<java.lang.String,java.util.List<java.lang.String>> getTracingHeaders()
Copyright © 2012–2020 Oracle Corporation. All rights reserved.