Repository navigation
Structured Logging with Stack Driver Logback Appender #2669
Copy link
Copy link
Closed
Labels
api: loggingIssues related to the Cloud Logging API.Issues related to the Cloud Logging API.priority: p2Moderately-important priority. Fix may not be included in next release.Moderately-important priority. Fix may not be included in next release.type: feature request‘Nice-to-have’ improvement, new feature or different behavior or design.‘Nice-to-have’ improvement, new feature or different behavior or design.
Description
Activity
As an update, it appears the issue would be here:
private LogEntry logEntryFor(ILoggingEvent e) { String payload = e.getFormattedMessage(); Level level = e.getLevel(); LogEntry.Builder builder = LogEntry.newBuilder(Payload.StringPayload.of(payload)) .setTimestamp(e.getTimeStamp()) .setSeverity(severityFor(level)); builder .addLabel(LEVEL_NAME_KEY, level.toString()) .addLabel(LEVEL_VALUE_KEY, String.valueOf(level.toInt())); if (loggingEnhancers != null) { for (LoggingEnhancer enhancer : loggingEnhancers) { enhancer.enhanceLogEntry(builder); } } return builder.build(); }It assumes that all data coming into the LoggingEvent is a StringPayload
- addedapi: loggingIssues related to the Cloud Logging API.Issues related to the Cloud Logging API.priority: p1Important issue which blocks shipping the next release. Will be fixed prior to next release.Important issue which blocks shipping the next release. Will be fixed prior to next release.
on Dec 7, 2017 @jabubake @andreamlin I'm not too sure how severe this problem is. I tagged P1, but please change if appropriate.
@bspradling8 : Markers is not currently supported, but we will look into adding them in a release soon.
Reacted by Łukasz Byjoś- addedpriority: p2Moderately-important priority. Fix may not be included in next release.Moderately-important priority. Fix may not be included in next release.and removedpriority: p1Important issue which blocks shipping the next release. Will be fixed prior to next release.Important issue which blocks shipping the next release. Will be fixed prior to next release.
on Dec 11, 2017 @dzlier-gcp FYI
@jabubake I think @andreamlin is now working on the autogen-clients, so I think this feature is on my plate. I'll self-assign.
- addedtype: questionRequest for information or clarification. Not an issue.Request for information or clarification. Not an issue.
on Dec 13, 2017 - addedtype: feature request‘Nice-to-have’ improvement, new feature or different behavior or design.‘Nice-to-have’ improvement, new feature or different behavior or design.and removedtype: questionRequest for information or clarification. Not an issue.Request for information or clarification. Not an issue.
on Dec 13, 2017 Move this issue to feature backlog and close it here. The place can continue to be used for discussion.
Is this still in backlog? or has it been fixed?
- added a commit that references this issue
on Mar 30, 2026 - added a commit that references this issue
on May 21, 2026
Metadata
Metadata
Assignees
Labels
api: loggingIssues related to the Cloud Logging API.Issues related to the Cloud Logging API.priority: p2Moderately-important priority. Fix may not be included in next release.Moderately-important priority. Fix may not be included in next release.type: feature request‘Nice-to-have’ improvement, new feature or different behavior or design.‘Nice-to-have’ improvement, new feature or different behavior or design.
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:
will result a Logstash with the following structure:
It seems like the Appender is completely ignoring these Marker objects when the should be getting jumped into the
jsonPayloadattribute of thecom.google.loggingLogEntryclass.Any help surrounding getting structured logging working with the StackDriver Logback Appender working would be greatly appreciated!