0

I have a spring boot application which uses log4j2 to write logs. When I deploy this application to a Docker container, I want the logs to be written to a file at a specified location outside the container. How can I do this ? I tried providing the path of the log folder using an environment variable on startup but its of no use. No logs are being written. Please help

user3594089
  • 71
  • 1
  • 3

1 Answers1

0

You have to mount the directory on the host file system inside the container. A simple web search will yield many results on how to do this such as How to mount a host directory in a Docker container

rgoers
  • 8,696
  • 1
  • 22
  • 24