Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How to stop Docker writing logs on host volume?

I have a Pyhton application running inside a Docker container, and I managed to use the logging module to write logs from the application on a file which is saved in a volume shared with the host. However, when I start the application, together with the test messages I write, I can see some other messages which seems to be logs from Docker. Here is how the log file appears after an execution of the application:

DEBUG:debug log test
INFO:info log test
INFO: * Running on all addresses (0.0.0.0)
   WARNING: This is a development server. Do not use it in a production deployment.
 * Running on http://127.0.0.1:5000
 * Running on http://172.17.0.2:5000 (Press CTRL+C to quit)

The third message is unwanted. Is it possible to avoid writing this kind of log messages?

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

Those are not messages from Docker, but from the application. In the Docker logs you see anything that the application writes to "system out".

If you don’t want to see these messages you need to redirect the output of the application running in Docker or use a separate logging option inside the application.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading