<p>I have to port an application (C/C++) to docker container.  The application writes to log files in file system.
How and where to store log file when application runs in container ?</p>

Chandu
<p>You have a couple of options:</p>

<ol>
<li>Have you application write to <code>/dev/stdout</code> and/or <code>/dev/stderr</code>.</li>
<li>Write to a log file on the filesystem.</li>
</ol>

<p>What it boils down to is "log collection" and how you want to go about collecting this data. Logging to stdout and stderr may be the simplest but it doesn't help you if you want to acquire and analyze very specific log data about your application.</p>

<p>Docker supports multiple "log drivers" which will help extract, transform and lift the log data to an external source ("ETL"). See: <a href="https://docs.docker.com/config/containers/logging/configure/" rel="nofollow noreferrer">https://docs.docker.com/config/containers/logging/configure/</a></p>

<p>For all of my applications I use FluentD and the docker log collector so I can do "smart" things with the data (<a href="https://fluentd.org" rel="nofollow noreferrer">https://fluentd.org</a>).</p>
