<p>I use logback to save the log to a file.</p>

<p>However, if i log on to the pod and see the log file, the log with logback is written well, but i can not find the log with sysout.</p>

<pre><code>kubectl exec -it pod-name bash
</code></pre>

<p>Also, if i check the kubernetes pod log, i can not see the log written in logback, but i can check only the log written in sysout.</p>

<pre><code>kubectl logs -f pod-name
</code></pre>

<p>In addition, when use logback and sysout  together at function, can not be found  any log using logback.</p>

<p>Do you know how to fix it?</p>

김태우
<p><code>kubectl logs -f &lt;pod_name&gt;</code> will show only actions which are affecting POD, not what is actually happening inside the container (any calculations, entered data to the file).</p>

<p>Without function is hard to say what is going to happen, however keeping logs inside the POD is not the best idea. If something happen to the POD, it will crashed or any error occurs, Kubernetes will restart it and all data will be lost.</p>

<p>The proper way is to have your application log to stdout and then use an external tool to capture that and write to a file. Fluentd is frequently used for that purpose, with aggregation i.e. ElasticSearch.</p>

<p>I would suggest you to look at <a href="https://kubernetes.io/docs/concepts/cluster-administration/logging/" rel="nofollow noreferrer">K8s logging architecture</a> and <a href="https://kubernetes.io/docs/tasks/debug-application-cluster/logging-elasticsearch-kibana/" rel="nofollow noreferrer">Elasticsearch</a></p>
