Changing log level at runtime in a clustered Spring Boot application
up vote
0
down vote
favorite
We have a Spring Boot application that runs clustered in an OpenShift environment. We can dynamically scale the application up and down, so we have as many instances as we need to handle the load.
This application uses SLF4J and Logback for logging. Now we would like to dynamically change the log level of all cluster members. Currently we do this by changing some system property in the deployment configuration (e.g. adding -Dlogging.level.com.example=DEBUG
) and then performing a rolling re-deploy of the application. Since the application is clustered and the update is performed in a rolling fashion there is no perceived downtime for the consumers of the app. However the app also runs background tasks which could be interrupted by a rolling deployment. Therefore we would rather have a way of updating the logging configuration of all cluster members without having to restart the application.
We know that logback supports monitoring a file, but we cannot replace files in the docker containers at runtime and even if we could we would need some way of ensuring that this happens simultaneously on all cluster members.
What would be a good way of achieving this?
spring-boot configuration logback
add a comment |
up vote
0
down vote
favorite
We have a Spring Boot application that runs clustered in an OpenShift environment. We can dynamically scale the application up and down, so we have as many instances as we need to handle the load.
This application uses SLF4J and Logback for logging. Now we would like to dynamically change the log level of all cluster members. Currently we do this by changing some system property in the deployment configuration (e.g. adding -Dlogging.level.com.example=DEBUG
) and then performing a rolling re-deploy of the application. Since the application is clustered and the update is performed in a rolling fashion there is no perceived downtime for the consumers of the app. However the app also runs background tasks which could be interrupted by a rolling deployment. Therefore we would rather have a way of updating the logging configuration of all cluster members without having to restart the application.
We know that logback supports monitoring a file, but we cannot replace files in the docker containers at runtime and even if we could we would need some way of ensuring that this happens simultaneously on all cluster members.
What would be a good way of achieving this?
spring-boot configuration logback
Enable the actuator and you can switch the loglevel at runtime by doing a POST to the logger endpoint. Or use Spring Cloud Config and refresh the configuration after changing it.
– M. Deinum
Nov 22 at 18:57
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
We have a Spring Boot application that runs clustered in an OpenShift environment. We can dynamically scale the application up and down, so we have as many instances as we need to handle the load.
This application uses SLF4J and Logback for logging. Now we would like to dynamically change the log level of all cluster members. Currently we do this by changing some system property in the deployment configuration (e.g. adding -Dlogging.level.com.example=DEBUG
) and then performing a rolling re-deploy of the application. Since the application is clustered and the update is performed in a rolling fashion there is no perceived downtime for the consumers of the app. However the app also runs background tasks which could be interrupted by a rolling deployment. Therefore we would rather have a way of updating the logging configuration of all cluster members without having to restart the application.
We know that logback supports monitoring a file, but we cannot replace files in the docker containers at runtime and even if we could we would need some way of ensuring that this happens simultaneously on all cluster members.
What would be a good way of achieving this?
spring-boot configuration logback
We have a Spring Boot application that runs clustered in an OpenShift environment. We can dynamically scale the application up and down, so we have as many instances as we need to handle the load.
This application uses SLF4J and Logback for logging. Now we would like to dynamically change the log level of all cluster members. Currently we do this by changing some system property in the deployment configuration (e.g. adding -Dlogging.level.com.example=DEBUG
) and then performing a rolling re-deploy of the application. Since the application is clustered and the update is performed in a rolling fashion there is no perceived downtime for the consumers of the app. However the app also runs background tasks which could be interrupted by a rolling deployment. Therefore we would rather have a way of updating the logging configuration of all cluster members without having to restart the application.
We know that logback supports monitoring a file, but we cannot replace files in the docker containers at runtime and even if we could we would need some way of ensuring that this happens simultaneously on all cluster members.
What would be a good way of achieving this?
spring-boot configuration logback
spring-boot configuration logback
asked Nov 22 at 15:09
Jan Thomä
9,12943468
9,12943468
Enable the actuator and you can switch the loglevel at runtime by doing a POST to the logger endpoint. Or use Spring Cloud Config and refresh the configuration after changing it.
– M. Deinum
Nov 22 at 18:57
add a comment |
Enable the actuator and you can switch the loglevel at runtime by doing a POST to the logger endpoint. Or use Spring Cloud Config and refresh the configuration after changing it.
– M. Deinum
Nov 22 at 18:57
Enable the actuator and you can switch the loglevel at runtime by doing a POST to the logger endpoint. Or use Spring Cloud Config and refresh the configuration after changing it.
– M. Deinum
Nov 22 at 18:57
Enable the actuator and you can switch the loglevel at runtime by doing a POST to the logger endpoint. Or use Spring Cloud Config and refresh the configuration after changing it.
– M. Deinum
Nov 22 at 18:57
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53433804%2fchanging-log-level-at-runtime-in-a-clustered-spring-boot-application%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Enable the actuator and you can switch the loglevel at runtime by doing a POST to the logger endpoint. Or use Spring Cloud Config and refresh the configuration after changing it.
– M. Deinum
Nov 22 at 18:57