Search code examples
spring-bootamazon-ecsamazon-cloudwatchlogs

Change logger on the fly in ECS


I am running a AWS ECS service which runs a ECS task having a container which is running a spring boot application as a docker file. I am settng the logger level in the application.properties file inside the spring boot application and streaming the logs to the Cloudwatch log steams.

As of now if I have to change the logger level, i need to change the log level in the application properties file and then invoke the CI/CD pipleline to redeploy the build in AWS ECS which seems not the right thing to do in a production environment.

I wish to know if there is a way to change this logger level on the fly without. If this means I have to change the way the log configuration is being changed I am ok with that too.


Solution

  • You can use actuator to change logging levels of loggers.

    https://docs.spring.io/spring-boot/docs/current/actuator-api/htmlsingle/#loggers.setting-level