Django: How do I get logging working?

Posted by swisstony on Stack Overflow See other posts from Stack Overflow or by swisstony
Published on 2010-05-16T08:47:19Z Indexed on 2010/05/16 8:50 UTC
Read the original article Hit count: 241

Filed under:
|
|
|

I've added the following to my settings.py file:

import logging
...
logging.basicConfig(level=logging.DEBUG,
    format='%(asctime)s %(levelname)s %(message)s',
    filename=os.path.join(rootdir, 'django.log'),
    filemode='a+')

And in views.py, I've added:

import logging
log = logging.getLogger(__name__)
...
log.info("testing 123!")

Unfortunately, no log file is being created. Any ideas what I am doing wrong? And also is their a better method I should be using for logging? I am doing this on Webfaction.

© Stack Overflow or respective owner

Related posts about django

Related posts about logging