From 6c275d4cd2cbcf9a568ca933268b9f626195ef36 Mon Sep 17 00:00:00 2001 From: Col Crunch Date: Sat, 23 May 2020 00:08:37 -0400 Subject: [PATCH] Add comment to local describing how to change logger level. Also update docs to be consistent with this change. --- .../project_name/settings/local.py | 4 ++++ docs/development/custom/logging.md | 20 ++++++++++++++++++- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/allianceauth/project_template/project_name/settings/local.py b/allianceauth/project_template/project_name/settings/local.py index 786bf38c..31f27fc1 100644 --- a/allianceauth/project_template/project_name/settings/local.py +++ b/allianceauth/project_template/project_name/settings/local.py @@ -22,6 +22,10 @@ INSTALLED_APPS += [ ] +# To change the logging level for extensions, uncomment the following line. +# LOGGING['handlers']['extension_file']['level'] = 'INFO' + + # Enter credentials to use MySQL/MariaDB. Comment out to use sqlite3 DATABASES['default'] = { 'ENGINE': 'django.db.backends.mysql', diff --git a/docs/development/custom/logging.md b/docs/development/custom/logging.md index edba7315..02c253eb 100644 --- a/docs/development/custom/logging.md +++ b/docs/development/custom/logging.md @@ -12,4 +12,22 @@ logger = get_extension_logger(__name__) ``` This works by creating a child logger of the extension logger which propagates all log entries -to the parent (extensions) logger. \ No newline at end of file +to the parent (extensions) logger. + +## Changing the Logging Level +By default, the extension logger's level is set to `DEBUG`. +To change this, uncomment (or add) the following line in `local.py`. + +```python +LOGGING['handlers']['extension_file']['level'] = 'INFO' +``` +*(Remember to restart your supervisor workers after changes to `local.py`)* + +This will change the logger's level to the level you define. + +Options are: *(all options accept entries of levels listed below them)* +* `DEBUG` +* `INFO` +* `WARNING` +* `ERROR` +* `CRITICAL`