This article explains how to configure Spring Boot app log level on Tanzu Application Service (TAS) for VMs for troubleshooting purposes.
Spring Boot supports log level ERROR, WARN, INFO, DEBUG, or TRACE. By default, ERROR-level, WARN-level, and INFO-level messages are logged. DEBUG-level and TRACE-level are helpful for troubleshooting any problem.
When deploying Spring Boot app to TAS for VMs, the log level can be specified with environment variable JAVA_OTPS.
cf set-env app JAVA_OPTS -Dlogging.level.root=DEBUG
In this case, the -D property set by cf set-env will be appended to the Spring Boot existing Java options.
logging.level.root configures the log level for all packages. If you only want to configure the log level for specified packages or frameworks, you can specify it instead of root.
cf set-env app JAVA_OPTS -Dlogging.level.org.cloudfoundry=DEBUG or cf set-env app JAVA_OPTS -Dlogging.level.org.springframework=DEBUG
The TAS for VMs Java buildpack also supports another format of configuration.
For example, the above configurations are identical to the following configurations:
cf set-env app LOGGING_LEVEL_ORG_CLOUDFOUNDRY DEBUG or cf set-env app LOGGING_LEVEL_ORG_SPRINGFRAMEWORK DEBUG
In addition, if Cloud Foundry actuator support is enabled (default setting) and the app has successfully started, the log level can also be configured through the Apps Manager UI. The log level configuration through App Manager UI take effects immediately without restart.