/** * Append a message to the log and to the list of trace messages that are sent in handshake response. * The logging will be postponed until the message can be provided with a session ID. Randomly generated session ID * is used if a session has not been created. * * @param logger logger to be used to log the message. * @param loggingLevel message level. * @param type type of the message. * @param messageParts message parts that will be stringified and concatenated to create a log message. */ public void appendTraceMessage(Logger logger, Level loggingLevel, Type type, Object... messageParts) { appendTraceMessageWithThrowable(logger, loggingLevel, type, null, messageParts); }
/** * Append a message to the log and to the list of trace messages that are sent in handshake response. * The logging will be postponed until the message can be provided with a session ID. Randomly generated session ID * is used if a session has not been created. * * @param logger logger to be used to log the message. * @param loggingLevel message level. * @param type type of the message. * @param messageParts message parts that will be stringified and concatenated to create a log message. */ public void appendTraceMessage(Logger logger, Level loggingLevel, Type type, Object... messageParts) { appendTraceMessageWithThrowable(logger, loggingLevel, type, null, messageParts); }
private DebugContext createDebugContext(UpgradeRequest upgradeRequest) { String thresholdHeader = upgradeRequest.getHeader(UpgradeRequest.TRACING_THRESHOLD); DebugContext.TracingThreshold threshold = tracingThreshold; Exception thresholdHeaderParsingError = null; if (thresholdHeader != null) { try { threshold = DebugContext.TracingThreshold.valueOf(thresholdHeader); } catch (Exception e) { thresholdHeaderParsingError = e; } } DebugContext debugContext; if (tracingType == DebugContext.TracingType.ALL || tracingType == DebugContext.TracingType.ON_DEMAND && upgradeRequest.getHeader(UpgradeRequest.ENABLE_TRACING_HEADER) != null) { debugContext = new DebugContext(threshold); } else { debugContext = new DebugContext(); } if (thresholdHeaderParsingError != null) { debugContext.appendTraceMessageWithThrowable(LOGGER, Level.WARNING, DebugContext.Type.MESSAGE_IN, thresholdHeaderParsingError, "An error occurred while parsing ", UpgradeRequest.TRACING_THRESHOLD, " header:", thresholdHeaderParsingError.getMessage()); } return debugContext; }
private DebugContext createDebugContext(UpgradeRequest upgradeRequest) { String thresholdHeader = upgradeRequest.getHeader(UpgradeRequest.TRACING_THRESHOLD); DebugContext.TracingThreshold threshold = tracingThreshold; Exception thresholdHeaderParsingError = null; if (thresholdHeader != null) { try { threshold = DebugContext.TracingThreshold.valueOf(thresholdHeader); } catch (Exception e) { thresholdHeaderParsingError = e; } } DebugContext debugContext; if (tracingType == DebugContext.TracingType.ALL || tracingType == DebugContext.TracingType.ON_DEMAND && upgradeRequest.getHeader(UpgradeRequest.ENABLE_TRACING_HEADER) != null) { debugContext = new DebugContext(threshold); } else { debugContext = new DebugContext(); } if (thresholdHeaderParsingError != null) { debugContext.appendTraceMessageWithThrowable(LOGGER, Level.WARNING, DebugContext.Type.MESSAGE_IN, thresholdHeaderParsingError, "An error occurred while parsing ", UpgradeRequest.TRACING_THRESHOLD, " header:", thresholdHeaderParsingError.getMessage()); } return debugContext; }