mirror of
https://github.com/netbox-community/netbox-docker.git
synced 2025-12-10 05:42:36 +00:00
Update configuration.py to use LOGGING environment variable
Update configuration.py to use a LOGGING environment variable to allow LOGGING configuration to be set via docker-compose.
LOGGING environment variable should be set to the full dictionary - example below:
`LOGGING: "{'version': 1, 'disable_existing_loggers': False, 'formatters': { 'timestamp': { 'format': '{asctime} {levelname} {message}', 'style': '{', }, }, 'handlers': { 'netbox-auth': { 'level': 'DEBUG', 'class': 'logging.FileHandler', 'formatter': 'timestamp', 'filename': '/var/log/netbox/netbox-auth.log', }, 'netbox': { 'level': 'DEBUG', 'class': 'logging.FileHandler', 'formatter': 'timestamp', 'filename': '/var/log/netbox/netbox.log', }, }, 'loggers': { 'netbox.auth': { 'handlers': ['netbox-auth'], 'level': 'DEBUG', }, 'django_auth_ldap': { 'handlers': ['netbox-auth'], 'level': 'DEBUG', }, 'netbox.views': { 'handlers': ['netbox'], 'level': 'DEBUG', }, 'netbox.api.views': { 'handlers': ['netbox'], 'level': 'DEBUG', }, },}"`
This commit is contained in:
parent
45f7823a17
commit
d4a7a4ab5a
|
|
@ -1,6 +1,7 @@
|
|||
import os
|
||||
import re
|
||||
import socket
|
||||
import ast
|
||||
|
||||
# For reference see http://netbox.readthedocs.io/en/latest/configuration/mandatory-settings/
|
||||
# Based on https://github.com/netbox-community/netbox/blob/develop/netbox/netbox/configuration.example.py
|
||||
|
|
@ -144,7 +145,10 @@ EXEMPT_VIEW_PERMISSIONS = list(filter(None, os.environ.get('EXEMPT_VIEW_PERMISSI
|
|||
|
||||
# Enable custom logging. Please see the Django documentation for detailed guidance on configuring custom logs:
|
||||
# https://docs.djangoproject.com/en/1.11/topics/logging/
|
||||
LOGGING = {}
|
||||
if "LOGGING" in os.environ:
|
||||
LOGGING = ast.literal_eval(os.environ.get('LOGGING'))
|
||||
else:
|
||||
LOGGING = {}
|
||||
|
||||
# Setting this to True will permit only authenticated users to access any part of NetBox. By default, anonymous users
|
||||
# are permitted to access most data in NetBox (excluding secrets) but not make any changes.
|
||||
|
|
|
|||
Loading…
Reference in a new issue