I have a spring-boot application running inside a docker container & its working fine. But the thing is application log file is empty inside the docker container. In logback-spring.xml log path has been configured to /var/log. When I go to /var/log directory inside the docker container, I can see log file has been created like “myservice.log” but when I “cat” the file to see the content, that is completely empty. Also when I execute
**docker logs <container-id>**
it returns nothing.
And also I checked the docker root directory in the server.
**/apps/docker/containers/<container-id>/<container-id-json.log>**
that is also empty.
my Dockerfile has the following structure.
**From private-docker-repo/openjdk:11-jre-slim**
**WORKDIR /opt/services**
**COPY target/my-service-0.0.1-SNAPSHOT.jar /opt/services/my-service.jar**
**CMD java -Dspring.profiles.active=dev -Dserver.port=61016 -jar my-service.jar**
**EXPOSE 61016**
What can be the reason for being the log file is empty here. Highly appreciate if anyone can point me out.
Edit - when I deploy the same jar using a linux systemd service logs are just writing fine. I want to know why the same jar not printing any logs inside the docker container
Thanks in advance…!