python logs both on console and file
<p>I would like to know what is the easiest way of writing the python logs on both the console and to a file.</p>

<p>I tried the logs to write into a file and read the file simultaneously and display but there was a delay on the console output</p>

<p>I also tried </p>

<pre><code>./sout.py 2&gt;&amp;1 | tee test.txt
</code></pre>

<p>which was also not effective. </p>

<p>Any suggestions please?</p>
