spring-attic / spring-cloud-gcp

Integration for Google Cloud Platform APIs with Spring
Apache License 2.0
704 stars 694 forks source link

Logs entires without severity #2618

Closed lechen26 closed 2 years ago

lechen26 commented 3 years ago

Hi

we've recently noticed some of our projects that writes logging to stackdriver does not includes severity.

in one of my kotlin project we use:

on my code we have something like:

private val log = LoggerFactory.getLogger(this.javaClass)
log.warn("Can't use this")

and this log meesage show on stackdriver with no severity image

is there any known issue on that area?

meltsufin commented 3 years ago

What does your Logback configuration look like? Do you have this?

<configuration>
  <include resource="org/springframework/cloud/gcp/logging/logback-appender.xml" />

  <root level="INFO">
    <appender-ref ref="STACKDRIVER" />
  </root>
</configuration>
kioie commented 3 years ago

@lechen26 @meltsufin tried and it seemed to work fine on my end. Only difference is that I was using spring-cloud-gcp-starter-logging(2.0.1-SNAPSHOT)

Code sample

public String log() {
        val log = LoggerFactory.getLogger(this.getClass());
        String message = "Can't use this";
        log.warn(message);
        return message;
    }

What it returned

Screenshot 2021-01-19 at 14 40 32
elefeint commented 2 years ago

Please reopen if this is still an issue.