I have file "a.py" with logging configuration written. Another file "b.py" where I just import logging and write log, it creates empty file but fails to write something onto it. Here are the code from two files. Please tell me where am I missing something. Thanks
"a.py"
import logging.config
LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'formatters': {
'default': {
'format': '%(asctime)s %(pathname)s:%(lineno)d %(message)s',
},
},
'handlers': {
'default': {
'level': 'DEBUG',
'class': 'logging.handlers.RotatingFileHandler',
'filename': 'rror.log',
'backupCount': 2,
'formatter': 'default',
},
'information': {
'level': 'INFO',
'class': 'logging.handlers.RotatingFileHandler',
'filename': 'information.log',
'backupCount': 2,
'formatter': 'default',
},
},
'loggers': {
'logger1': {
'handlers': ['default'],
'level': 'DEBUG',
'propagate': False,
},
'logger2': {
'handlers': ['information'],
'level': 'INFO',
'propagate': False,
},
},
}
logging.config.dictConfig(LOGGING)
"b.py"
import logging
logging.getLogger('logger1').info("hey there!")
logging.getLogger('logger2').debug("hey logger2")