sap-cloud-platformsap-cloud-sdksap-cloud-foundry

Change log level at runtime for a cf application based on SAP Java Buildpack


Following the guide over here: https://sap.github.io/cloud-sdk/docs/java/guides/logging-overview#logging-overview

I am trying to use CF CLI cf set-env command to change the logs levels at runtime. This commands executes successfully and the log levels are only changed when I do a cf restage srv or cf restart srv. srv is the name of my application.

Is there any alternative where I don't have to stop the cf application and still be able to change the log levels at runtime?


Solution

  • No, I think in order to reload the setting from environment variables a reload is required.

    You could instead implement a new endpoint in your application where you set the log level programatically. But that depends on the logging framework you are using. E.g. for Logback this can be done as described here.