mirror of
https://github.com/netbox-community/netbox-docker.git
synced 2024-11-22 07:53:46 +01:00
Add expample logging configuration
This commit is contained in:
parent
eb5cc88b25
commit
8176ef8499
1
.gitignore
vendored
1
.gitignore
vendored
@ -9,6 +9,7 @@ configuration/*
|
||||
configuration/ldap/*
|
||||
!configuration/ldap/extra.py
|
||||
!configuration/ldap/ldap_config.py
|
||||
!configuration/logging.py
|
||||
!configuration/plugins.py
|
||||
prometheus.yml
|
||||
super-linter.log
|
||||
|
53
configuration/logging.py
Normal file
53
configuration/logging.py
Normal file
@ -0,0 +1,53 @@
|
||||
from os import environ
|
||||
|
||||
# Set LOGLEVEL in netbox.env or docker-compose.overide.yml to override a logging level of INFO.
|
||||
LOGLEVEL = environ.get('LOGLEVEL', 'INFO')
|
||||
|
||||
LOGGING = {
|
||||
|
||||
'version': 1,
|
||||
'disable_existing_loggers': False,
|
||||
'formatters': {
|
||||
'verbose': {
|
||||
'format': '{levelname} {asctime} {module} {process:d} {thread:d} {message}',
|
||||
'style': '{',
|
||||
},
|
||||
'simple': {
|
||||
'format': '{levelname} {message}',
|
||||
'style': '{',
|
||||
},
|
||||
},
|
||||
'filters': {
|
||||
'require_debug_false': {
|
||||
'()': 'django.utils.log.RequireDebugFalse',
|
||||
},
|
||||
},
|
||||
'handlers': {
|
||||
'console': {
|
||||
'level': LOGLEVEL,
|
||||
'filters': ['require_debug_false'],
|
||||
'class': 'logging.StreamHandler',
|
||||
'formatter': 'simple'
|
||||
},
|
||||
'mail_admins': {
|
||||
'level': 'ERROR',
|
||||
'class': 'django.utils.log.AdminEmailHandler',
|
||||
'filters': ['require_debug_false']
|
||||
}
|
||||
},
|
||||
'loggers': {
|
||||
'django': {
|
||||
'handlers': ['console'],
|
||||
'propagate': True,
|
||||
},
|
||||
'django.request': {
|
||||
'handlers': ['mail_admins'],
|
||||
'level': 'ERROR',
|
||||
'propagate': False,
|
||||
},
|
||||
'django_auth_ldap': {
|
||||
'handlers': ['console',],
|
||||
'level': LOGLEVEL,
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user