Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Spring Boot: How to properly send error logs to Stackdriver on GCP

I have this Spring Boot application deployed on a kubernetes cluster on GCP.

Logs are sent to stackdriver and I can't see them on logging section as you can see below:

enter image description here

But they have the wrong severity (INFO) on the platform, that means they don't appear on the error reporting section.

My question is what is needed to be configured to get logs produced by a spring boot application to be read properly by Stackdriver.

like image 816
Marcos J.C Kichel Avatar asked Oct 28 '25 08:10

Marcos J.C Kichel


1 Answers

Could you provide your logging code?

In the meantime, there's a Google-supported Spring Boot Logging integration, and here's a sample of that: https://github.com/spring-cloud/spring-cloud-gcp/blob/master/spring-cloud-gcp-samples/spring-cloud-gcp-logging-sample/src/main/java/com/example/ExampleController.java

This sample uses a org.apache.commons.logging.Log, so you could do Log.error().

like image 109
somegcpjavahelp Avatar answered Oct 30 '25 04:10

somegcpjavahelp



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!