I successfully set up Django logging, but I find myself in need to log some information inside settings.py. Is that possible?
Currently, the settings only come into effect after the entire file is parsed, which I believe is expected. Is there a way to force the set up of loggers right after specifying them? Otherwise, are there any alternatives that people recommend?
LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'formatters': {
'console': {
'format': '%(levelname)s: %(message)s'
},
},
'handlers': {
'console': {
'level': 'DEBUG',
'class': 'logging.StreamHandler',
'formatter': 'console'
}
},
'loggers': {
'main': {
'handlers': ['console'],
'level': 'INFO',
'propagate': False,
},
},
}
# The below does not work because the setup declared above is not yet in effect
logger = logging.getLogger('main')
logger.info("Works?")