0

I'm trying to configure my spring-boot-app to log properly to GKE and display the levels correctly. Currently I get:

{
  "textPayload": "[2023-02-27 13:48:15:099] [utility-service-v1] [,,] [WARN ] - [           main] org.hibernate.orm.deprecation  - HHH90000026: PostgreSQL94Dialect has been deprecated; use org.hibernate.dialect.PostgreSQLDialect instead",
  "insertId": "4lv0e5rnu1p",
  
  },
  "timestamp": "2023-02-27T13:48:15.100214978Z",
  "severity": "INFO",
}

You can see the severity shows up as INFO even though the log level is WARN. The only way I've been able to correctly get the log level to display, is to configure the logs to be JSON format, however, then viewing the logs in kubectl is useless. My current configuration for logs is only:

  pattern:
    console: "[%d{yyy-MM-dd HH:mm:ss:SSS}] [${spring.application.name}] [%X{traceId},%X{spanId},%X{spanExportable}] [%-5level] - [%15.15t] %-30.30c{1.} - %m%n"

This is on SB 3.0.2 with spring-cloud-gcp 4.1.1. I've tried with/without spring-cloud-gcp-starter-logging which didn't seem to make a difference. Any thoughts on how to get google to properly read the log level while still having the logs easily readable?

Tim
  • 77
  • 9
  • You may check these Stackoverflow threads [1](https://stackoverflow.com/questions/55800765/gcp-and-spring-logback-severity-is-always-info) [2](https://stackoverflow.com/questions/44164730/gke-stackdriver-java-logback-logging-format) – Siegfred V. Feb 27 '23 at 23:31
  • Thanks, but this isn't solving the issue. I am able to get it to show severity if using the json logging. I wanted to find out if there's a way for gke to ingest logs in the json format, while also having the container logging to standard out the normal easily readable logs. It seems like you can have one or the other, gke logs the correct level, or I can easily read the logs, but not both – Tim Feb 28 '23 at 13:51
  • > is to configure the logs to be JSON format, however, then viewing the logs in kubectl is useless. QQ: why viewing these logs in kubectl is useless – Mark Apr 01 '23 at 18:52

0 Answers0