Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Logging config options added #583

Open
wants to merge 16 commits into
base: main
Choose a base branch
from
Open
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ coldfront.db
db.json
.env
.devcontainer/*
.bin/*
.bin/*
22 changes: 15 additions & 7 deletions coldfront/config/logging.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from django.contrib.messages import constants as messages
from coldfront.config.env import ENV

#------------------------------------------------------------------------------
# ColdFront logging config
Expand All @@ -12,27 +13,34 @@
messages.ERROR: 'danger',
}

FILE_ENABLE = ENV.bool('FILE_ENABLE', default=False)
LOG_LEVEL = ENV.str('LOG_LEVEL', default="INFO")
LOG_LEVEL_LDAP = ENV.str('LOG_LEVEL_LDAP', default=LOG_LEVEL)
LOGGING_FILE = ENV.str('LOGGING_FILE', default="/tmp/debug.log")
LOGGING_VERSION = ENV.int('LOGGING_VERSION', default=1)


LOGGING = {
'version': 1,
'version': LOGGING_VERSION,
'disable_existing_loggers': False,
'handlers': {
'console': {
'class': 'logging.StreamHandler',
},
# 'file': {
# 'class': 'logging.FileHandler',
# 'filename': '/tmp/debug.log',
# },
'file': {
'class': 'logging.FileHandler',
'filename': LOGGING_FILE,
},
},
'loggers': {
'django_auth_ldap': {
'level': 'WARN',
'level': LOG_LEVEL_LDAP,
# 'handlers': ['console', 'file'],
'handlers': ['console', ],
},
'django': {
'handlers': ['console'],
'level': 'INFO',
'level': LOG_LEVEL,
},
},
}
11 changes: 11 additions & 0 deletions docs/pages/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,17 @@ DB_URL=psql://user:[email protected]:5432/database
DB_URL=sqlite:////usr/share/coldfront/coldfront.db
```

### Logging settings

The following settings configure the logging settings for ColdFront and will help in debugging or viewing extra information if developing ColdFront:

| Name | Description |
| :--------------------|:-------------------------------------|
| LOG_LEVEL | The level to set logging to (DEBUG, INFO, WARNING, ERROR, CRITICAL) |
| LOG_LEVEL_LDAP | The level to set logging to in LDAP (defaults to LOG_LEVEL if not set) |
| LOGGING_FILE | The file to log to if set |
| LOGGING_VERSION | The logging version (1 by default) |


### Email settings

Expand Down