This Spring Boot application is configured with more logback appenders to send logs to fluentd using fluency.
The application declares two schedule methods to simulate some activity to log. One method logs at info-level the current time every second. The other method logs an exception with stack trace every 10 seconds at warning level.
This repository includes a Docker Compose file that declares a fluentd service bound to the default fluentd port, 24224. To start the service run:
docker-compose up -d
./mvnw spring-boot:run
You won't see anything after the initial banner since the only appender configured sends to fluend.
docker exec try-spring-boot-logging-to-fluentd_fluentd_1 tail -f /fluentd/log/data.log
The logback configuration for fluentd is located in fluency.xml and that is included by logback-spring.xml. That approach to customizing log configuration in Spring Boot is described in the logging chapter of the Spring Boot reference.