Skip to content

Instantly share code, notes, and snippets.

@Ruslan-Skira
Last active October 6, 2020 13:14
Show Gist options
  • Save Ruslan-Skira/ecb7c655826664b200fd91282745c92f to your computer and use it in GitHub Desktop.
Save Ruslan-Skira/ecb7c655826664b200fd91282745c92f to your computer and use it in GitHub Desktop.
orm_requests_loggs_django_settings
import logging.config
LOGGING_CONFIG = None
LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'handlers': {
'console': {
'class': 'logging.StreamHandler',
'formatter': 'file_format',
},
'file': {
'level': 'INFO',
'class': 'logging.FileHandler',
# create file before
'filename': '/home/user/Projects/linkedingame/namesgames/namesgames/debug.log',
'formatter': 'file_format',
},
},
'loggers': {
# root logger
'django': {
'handlers': ['console'],
'propagate': True,
#'level': os.getenv('DJANGO_LOG_LEVEL', 'INFO'),
},
# application user and views need to create
'user.views': {
'level': 'INFO',
'handlers': ['file', 'console'],
'propagate': False,
},
'django.utils.autoreload': {
'level': 'WARNING',
'handlers': ['console'],
}
},
'formatters': {
'file_format': {
'format': '{levelname} {asctime} {module} {process:d} {thread:d} {message}',
'style': '{',
},
}
}
logging.config.dictConfig(LOGGING)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment