Skip to content

Logback Appender for Google Cloud Logging does not comply with Error Reporting #4179

Description

@drelum

Logback Appender for Google Cloud Logging does not comply with STACKDRIVER ERROR REPORTING.

See https://cloud.google.com/error-reporting/docs/formatting-error-messages

Field"serviceContext" is mandatory and is not being generated by com.google.cloud.logging.logback.LoggingAppender

The following method should be changed:

  private LogEntry logEntryFor(ILoggingEvent e) {
    StringBuilder payload = new StringBuilder(e.getFormattedMessage()).append('\n');
    writeStack(e.getThrowableProxy(), "", payload);

    Level level = e.getLevel();
    LogEntry.Builder builder =
        LogEntry.newBuilder(Payload.StringPayload.of(payload.toString().trim()))
            .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);
      }
    }

    if (loggingEventEnhancers != null) {
      for (LoggingEventEnhancer enhancer : loggingEventEnhancers) {
        enhancer.enhanceLogEntry(builder, e);
      }
    }

    return builder.build();
  }

Activity

  1. changed the title [-]Logback Appender for Google Cloud Logging does not comply with Error Reportin[/-] [+]Logback Appender for Google Cloud Logging does not comply with Error Reporting[/+] on Dec 5, 2018
  2. ajaaym commented on Dec 6, 2018

    @ajaaym
    Contributor

    google-cloud-errorreporting is separate service than google-cloud-logging and logback appender for google-cloud-logging is not integrated with cloud error reporting yet.

  3. added
    type: feature request‘Nice-to-have’ improvement, new feature or different behavior or design.
    and removed
    triage meI really want to be triaged.
    on Dec 6, 2018
  4. ajaaym commented on Dec 6, 2018

    @ajaaym
    Contributor

    more information over #2912 #2669 #3031 Closing this and we will track this in #3031

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

api: clouderrorreportingIssues related to the Error Reporting API.type: feature request‘Nice-to-have’ improvement, new feature or different behavior or design.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions