Python Forum
module logging posting randomly - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: module logging posting randomly (/thread-18348.html)



module logging posting randomly - DJ_Qu - May-14-2019

Hello,
I am writing a program with a lot of print() so I use the module logging for debugging purposes. The problem is that when I put logging.debug('some text') in the code, it dumps debugging information when it feels like instead of when it is supposed happen in the code, like a print. How to get my logging behave like a print?


RE: module logging posting randomly - buran - May-14-2019

Post your code in python tags. Do you use log from multiple threads? Although you may expect same effects when print from multiple threads


RE: module logging posting randomly - DJ_Qu - May-14-2019

I don't think I use multiple threads.
My code is nothing special, I have an
import logging
at the top
and then a series of
logging.debut('Game engine init ...')
logging.debut('Player one initialised')
And those appear randomly between the print statements that we use for the real game.