[Tutor] Where does logging put its files?

Alan Gauld alan.gauld at btinternet.com
Thu Apr 24 17:42:40 CEST 2014


I've been playing with the logging module - long overdue!

I started with the basic tutorial but fell at the first hurdle.
It says to specify a file in the logging.basicConfig() function then 
asks you to open the file after logging some events.

But I can't find the file anywhere...

Here's my code:

 >>> import logging
 >>> logging.basicConfig(file='./log.txt', level=logging.DEBUG)
 >>> logging.info('some stuff')
INFO:root:some stuff
 >>> logging.error('Somethings burning')
ERROR:root:Somethings burning
 >>> logging.critical('I warned you!')
CRITICAL:root:I warned you!
 >>>

But if I exit Python there is no file called log.txt
that I can find either in the current folder or in my
home folder. The tutorial seems to suggest it
should be obvious...

Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.flickr.com/photos/alangauldphotos



More information about the Tutor mailing list