<p>I have do a logging example</p>
<pre><code>apiVersion: v1
kind: Pod
metadata:
  name: counter
spec:
  containers:
  - name: count
    image: busybox:1.28
    args: [/bin/sh, -c,
            'i=0; while true; do echo &quot;$i: $(date)&quot;; i=$((i+1)); sleep 1; done']
</code></pre>
<p>to create this counter</p>
<pre><code>kubectl apply -f counter.yaml
</code></pre>
<p>to get logs</p>
<pre><code>kubectl logs counter
</code></pre>
<p>taken from : <a href="https://kubernetes.io/docs/concepts/cluster-administration/logging/" rel="nofollow noreferrer">Kubernetes logging example</a>
how ever when i tried the same with python <code>print</code> or <code>stdout.write</code> its not working</p>

Pradeep Padmanaban C
<p>Python by default buffers its output to <code>stdout</code> and <code>stderr</code>. Add an env variable named PYTHONUNBUFFERED and set it to something (anything as long as its not empty). You can set it in the <code>env</code> block in the pod yaml or set it in the Docker image as in <a href="https://stackoverflow.com/questions/59812009/what-is-the-use-of-pythonunbuffered-in-docker-file">this answer</a></p>
