简体   繁体   中英

Stackdriver - All logs are mapped as INFO

All my logs ERROR/WARNIN are mapped as INFO at Stackdriver. I'm using logback and Im running my application in a Kubernetes cluster.

How can I setup my logback to Stackdriver?

Tks

The Stackdriver logging agent configuration for Kubernetes defaults to INFO for any logs written to the container's stdout and ERROR for logs written to stderr. If you want finer-grained control over severity, you can configure Spring to log as single-line JSON (eg, via JsonLayout 1 ) and let the logging agent pick up the severity from the JSON object (see https://cloud.google.com/logging/docs/agent/configuration#process-payload ).

1 By default, JsonLayout will use "level" for the log level, while the Stackdriver logging agent recognizes "severity", so you may have to override addCustomDataToJsonMap .

See also GKE & Stackdriver: Java logback logging format?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM