Last active
May 16, 2023 17:59
-
-
Save rehbarkhan/0ae33f589a01ccc8d572a61fb4ae5b92 to your computer and use it in GitHub Desktop.
Django Loggin Enable
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
LOGGING = { | |
'version':1, | |
'disable_existing_loggers':False, | |
'formatters':{ | |
'main_formatter':{ | |
'format':"{asctime} {levelname} {pathname} {module} {lineno} {message}", | |
"style":"{" | |
} | |
}, | |
'handlers':{ | |
# 'console':{ | |
# 'class':'logging.StreamHandler', | |
# 'formatter':'main_formatter' | |
# }, | |
'file':{ | |
'class':'logging.FileHandler', | |
'filename':'info.log', | |
'formatter':'main_formatter' | |
} | |
}, | |
'loggers':{ | |
'main':{ | |
'handlers':['file'], | |
'propagate':True, | |
'level':'INFO' | |
} | |
} | |
} | |
import logging | |
logger = logging.getLogger('main') | |
logger.debug("This is debug msg which will be getting printed on the log file") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is the piece of code for the Django logging system.