I am trying to get started with Django and as a first toyproject I am using functionality to send emails and for logging in an existing application
Here's a small script:
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "settings")
import logging
logger = logging.getLogger("myLogger")
logger.debug("A")
logger.info("B")
logger.error("C")
my settings.py sits in the very same folder with the following code fragment in there:
LOGGING = {
'version': 1,
'disable_existing_loggers': True,
'handlers': {
'file': {
'level': 'DEBUG',
'class': 'logging.FileHandler',
'filename': 'tmp//debug.log',
},
},
'loggers': {
'myLogger': {
'handlers': ['file'],
'level': 'DEBUG',
'propagate': True,
},
},
}
When executing (running the script, no Django server involved) it produces the output
No handlers could be found for logger "myLogger"
Any comments? I can use the standard logger but my suspicion is that I am missing something rather fundamental here...
Thomas