Force log when trace is enabled

Enable force logging for all log statements when a trace for a REST call
or a Git push is requested.

Force logging means that all log statements will be written
to the error log regardless of the severity of the log statement and the
configured log levels.

This allows to get more information about single requests and makes
debugging them easier.

Change-Id: Id13556d8ee25bbc91a44d58177b771e22043106f
Signed-off-by: Edwin Kempin <ekempin@google.com>
This commit is contained in:
Edwin Kempin
2018-08-09 14:28:21 +02:00
parent e7e04d27b2
commit a913d3af09
10 changed files with 139 additions and 12 deletions

View File

@@ -53,7 +53,7 @@ public abstract class SshCommand extends BaseCommand {
if (trace) {
RequestId traceId = new RequestId();
stderr.println(String.format("%s: %s", RequestId.Type.TRACE_ID, traceId));
return TraceContext.open().addTag(RequestId.Type.TRACE_ID, traceId);
return TraceContext.open().forceLogging().addTag(RequestId.Type.TRACE_ID, traceId);
}
return TraceContext.DISABLED;
}