Package google.registry.util
Class GcpJsonFormatter
java.lang.Object
java.util.logging.Formatter
google.registry.util.GcpJsonFormatter
JUL formatter that formats log messages in a single-line JSON that Stackdriver logging can parse.
The structured logs written to STDOUT
and STDERR
will be picked up by GAE/GKE
logging agent and automatically ingested by Stackdriver. Certain fields (see below) in the JSON
will be converted to the corresponding Log Entry
fields and parsed by Log Explorer.
- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic String
Get the Trace ID associated with any logging done by the current thread.static void
Set the Trace ID associated with any logging done by the current thread.Methods inherited from class java.util.logging.Formatter
formatMessage, getHead, getTail
-
Constructor Details
-
GcpJsonFormatter
public GcpJsonFormatter()
-
-
Method Details
-
setCurrentTraceId
Set the Trace ID associated with any logging done by the current thread.- Parameters:
id
- The traceID, in the form projects/[PROJECT_ID]/traces/[TRACE_ID]
-
getCurrentTraceId
Get the Trace ID associated with any logging done by the current thread.- Returns:
- id The traceID
-
format
-