question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Structured Logging with Stack Driver Logback Appender

See original GitHub issue

Currently 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:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
jabubakecommented, Dec 11, 2017

@bspradling8 : Markers is not currently supported, but we will look into adding them in a release soon.

0reactions
sschwellcommented, Feb 1, 2021

Is this still in backlog? or has it been fixed?

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found