-
Notifications
You must be signed in to change notification settings - Fork 34
Description
It would be great to have a GCP format https://cloud.google.com/logging/docs/structured-logging
Log4j2 has some support the mappings are documented: https://logging.apache.org/log4j/2.x/manual/json-template-layout.html
sepecifically they say:
GcpLayout.json described by Google Cloud Platform structured logging with additional _thread, _logger and _exception fields. The exception trace, if any, is written to the _exception field as well as the message field – the former is useful for explicitly searching/analyzing structured exception information, while the latter is Google’s expected place for the exception, and integrates with Google Error Reporting.
it would be great if this was somewhat compatible a sample message from log4j2 in GcpLayout:
{
"timestamp": "2022-05-06T15:11:13.059Z",
"severity": "ERROR",
"message": "error abc due to:\nabc.def.ghi.MyException: problem specifics.\nMore details ...",
"logging.googleapis.com/sourceLocation": {
"function": "abc.def.ghi.MyClass.recordSendError"
},
"logging.googleapis.com/insertId": "1261298",
"_exception": {
"class": "org.apache.kafka.common.errors.TimeoutException",
"message": "problem specifics",
"stackTrace": "MyException: problem specifics.\nMore details ..."
},
"_thread": "mythread-1",
"_logger": "abc.def.ghi.MyClass"
}