cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

SET_LOGGING_LEVEL does not work

zje8szh
Participant
0 Likes
988

Hello,

I am trying to change the log level by SET_LOGGING_LEVEL. Details in manifest.yml are below.

---
applications:

- name: springbootlogging
memory: 1024M
timeout: 300
random-route: true
path: application/target/springbootlogging-application.jar
buildpacks:
- sap_java_buildpack
env:
TARGET_RUNTIME: main
SPRING_PROFILES_ACTIVE: 'cloud'
JBP_CONFIG_SAPJVM_MEMORY_SIZES: 'metaspace:128m..'
SET_LOGGING_LEVEL: '{ROOT: WARN, cn.sdk.springboot.controllers: ERROR}'
services:
- my-application-logs
# - my-xsuaa
# - my-destination
# - my-connectivity

There is also a configuration file logback-spring.xml for logback. I can modify the log level by setting logback-spring.xml. But seems it does not work in manifest way.

Could you give me some suggestions?

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Likes

Hi Jerry,

You could try to change the JAVA_OPTS env variable as desribed in these two links:

https://github.com/cloudfoundry/java-buildpack/blob/master/docs/framework-java_opts.md
https://stackoverflow.com/questions/34181094/set-logging-level-in-spring-boot-via-environment-variab...

In your case it could be something like:

cf set env JAVA_OPTS '-Dlogging.level.cn.sdk.springboot.controllers=ERROR'

or

env:

java_opts: -Dlogging.level.cn.sdk.springboot.controllers:ERROR

Or maybe the best solution would be:

env:

java_opts: '$java_opts -Dlogging.level.cn.sdk.springboot.controllers:ERROR'

Regards,

Mihailo