Skip to content

Stacktrace should not be written to log message #34

@rumatoest

Description

@rumatoest

Hello.

I've noticed pretty strange things. Somehow you are adding whole stack trace information to textPayload which is weird. Also it look very ugly in stackdriver logging web UI because you just put there extremely long string that can not be displayed in nice and verbose way.

I think that nobody wants to see it in textPayload. Why you can't add full stacktrace to property/label named "stacktrace" ?

As for textPayload the only one reasonable modification is to add only message from exception at new line

This is part of the code that does all this things

  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));

Metadata

Metadata

Assignees

Labels

api: loggingIssues related to the googleapis/java-logging 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