Unwanted timestamp when using print in python
<p>I am using autobahn[twisted] to achieve some WAMP communication. While subscribing to a topic a getting feed from it i print it. When i do it i get something like this:</p>

<pre><code>2016-09-25T21:13:29+0200 (u'USDT_ETH', u'12.94669009', u'12.99998074', u'12.90000334', u'0.00035594', u'18396.86929477', u'1422.19525455', 0, u'13.14200000', u'12.80000000')
</code></pre>

<p>I have sacrificed too many hours to take it out. And yes, i tested other things to print, it print without this timestamp. This is my code:</p>

<pre><code>from twisted.internet.defer import inlineCallbacks
from autobahn.twisted.wamp import ApplicationSession, ApplicationRunner

class PushReactor(ApplicationSession):
        @inlineCallbacks
        def onJoin(self, details):
                print "subscribed"
                yield self.subscribe(self.onTick, u'ticker')

        def onTick(self, *args):
                print args

if __name__ == '__main__':
        runner = ApplicationRunner(u'wss://api.poloniex.com', u'realm1')
        runner.run(PushReactor)
</code></pre>

<p>How can i remove this timestamp?</p>

<p>Well, <code>sys.stderr</code> and <code>sys.stdout</code> are redirected to a twisted logger.</p>

<p>You need to change the logging format before running you app.</p>

<p>See: <a href="https://twistedmatrix.com/documents/15.2.1/core/howto/logger.html" rel="nofollow">https://twistedmatrix.com/documents/15.2.1/core/howto/logger.html</a></p>

<h2>How to reproduce</h2>

<p>You can reproduce your problem with this simple application:</p>

<pre><code>from autobahn.twisted.wamp import ApplicationRunner

if __name__ == '__main__':
    print("hello1")
    runner = ApplicationRunner(u'wss://api.poloniex.com', u'realm1')
    print("hello2")
    runner.run(None)
    print("hello3")
</code></pre>

<p>When the process is killed, you'll see:</p>

<pre><code>hello1
hello2
2016-09-26T14:08:13+0200 Received SIGINT, shutting down.
2016-09-26T14:08:13+0200 Main loop terminated.
2016-09-26T14:08:13+0200 hello3
</code></pre>

<p>During application launching, <code>stdout</code> (and <code>stderr</code>) are redirected to a file-like object (of class <code>twisted.logger._io.LoggingFile</code>).</p>

<p>Every call to <code>print</code> or <code>write</code> are changed in twister log messages (one for each line).</p>

<p>The redirection is done in the class <code>twisted.logger._global.LogBeginner</code>, look at the <code>beginLoggingTo</code> method.</p>

python printing timestamp autobahn