I am trying to use logging in my small python project. Following the tutorial, I added the code below to my code, but the message wan't logged to the file as it was supposed to.
import logging logging.basicConfig( filename = "a.log", filemode="w", level = logging.DEBUG) logging.error("Log initialization failed.") There was no log file created in the pwd. (I have used the following code to print out the pwd, and I am sure I checked the right directory.) So I manually created the file and ran the code, but the message was still not logged.
print "argv: %r"%(sys.argv,) print "dirname(argv[0]): %s"%os.path.abspath(os.path.expanduser(os.path.dirname(sys.argv[0]))) print "pwd: %s"%os.path.abspath(os.path.expanduser(os.path.curdir)) Has someone any clue what I did wrong here? Thanks in advance.
There was log file, do you meanthere was no log file?