Reputation: 6888
I must be missing something here because the log prints on the same line. I thought that logging module automatically creates new line?
temp = int(2489)
logging.basicConfig( filename='temp.log',
filemode='a',
format='%(asctime)s\n:%(message)s',
datefmt = '%s',
level=logging.DEBUG )
logging.info(temp)
time.sleep(1)
Same happens with basic example:
logging.basicConfig(filename="example.log")
logging.debug("This message should go to the log file")
logging.info("So should this")
logging.warning("And this, too")
Upvotes: 1
Views: 1569
Reputation: 6888
I was about to give up and just write to a file the old fashioned way when I realised the problem was not python related.
The line breaks were there but Notepad simply did not show them! Sublime Text 2 showed them just fine. So the solution is not to use Notepad as it simply does not work for non-windows created text files.
Upvotes: 1