Structured Logging with Stack Driver Logback Appender
See original GitHub issueCurrently there is a Java Logback Appender that allows Java Applications to utilize the SLF4J interface and log to StackDriver.
SLF4J has the concept of Marker objects that allows users to include objects to enrich the log messages. It seems that the StackDriver Logback Appender is ignoring these Marker objects while logging to StackDriver.
To show an example, the following log statement:
logger.with(anObject).info("The request was successful");
will result a Logstash with the following structure:
{
labels: { ... labels here ... },
logName: 'java.log',
resource: { ... resource here ... },
severity: 'INFO',
textPayload: "The request was successful",
timestamp: "2017-11-30T01:21:59.205Z
}
It seems like the Appender is completely ignoring these Marker objects when the should be getting jumped into the jsonPayload
attribute of the com.google.logging
LogEntry
class.
Any help surrounding getting structured logging working with the StackDriver Logback Appender working would be greatly appreciated!
Issue Analytics
- State:
- Created 6 years ago
- Reactions:1
- Comments:7 (4 by maintainers)
Top Results From Across the Web
Setting Up Cloud Logging for Java | Google Cloud
You can write logs to Cloud Logging from Java applications by using the Logback appender or a java.util.logging handler, or by using the...
Read more >Google Cloud Structured Logging for Java Applications
Configuring Logging The simplest approach, if using Logback, is to use the Logging appender provided by Google Cloud available here - https:// ...
Read more >Java Logging on Cloud Run with Stackdriver - Medium
Using the logstash-logback-encoder library allows for event specific custom fields, which means we can add key-value StructuredArguments to our ...
Read more >Logging to Stackdriver using Logback's Console JSON ...
Logging to Stackdriver using Logback's Console JSON Appender ... I've installed the logging agent, with the structured config:
Read more >Logging - Spring Boot on GCP
You can user Spring Cloud GCP's Logging Starter to use pre-configured Logback appenders to produce Structured JSON logs, or send the log via...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@bspradling8 : Markers is not currently supported, but we will look into adding them in a release soon.
Is this still in backlog? or has it been fixed?