Skip to content

Commit

Permalink
adds log-level documentation.
Browse files Browse the repository at this point in the history
  • Loading branch information
birkin committed Oct 16, 2024
1 parent 7521fc3 commit 110cf3c
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions config/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,9 @@

DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'

## reminder:
## "Each 'logger' will pass messages above its log-level to its associated 'handlers',
## ...which will then output messages above the handler's own log-level."
LOGGING = {
'version': 1,
'disable_existing_loggers': True,
Expand All @@ -163,7 +166,7 @@
'include_html': True,
},
'logfile': {
'level':'DEBUG',
'level': os.environ.get( 'LOG_LEVEL', 'INFO' ), # add LOG_LEVEL=DEBUG to the .env file to see debug messages
'class':'logging.FileHandler', # note: configure server to use system's log-rotate to avoid permissions issues
'filename': os.environ['LOG_PATH'],
'formatter': 'standard',
Expand All @@ -182,7 +185,7 @@
},
'foo_app': {
'handlers': ['logfile'],
'level': os.environ['LOG_LEVEL'],
'level': 'DEBUG', # messages above this will get sent to the `logfile` handler
'propagate': False
},
# 'django.db.backends': { # re-enable to check sql-queries! <https://docs.djangoproject.com/en/4.2/ref/logging/#django-db-backends>
Expand Down

0 comments on commit 110cf3c

Please sign in to comment.