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

Update configuration.py to use LOGGING environment variable #299

Closed
wants to merge 1 commit into from

Conversation

jbromwic
Copy link

@jbromwic jbromwic commented May 19, 2020

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', }, },}"

Related Issue: None

New Behavior

Allows an environment variable to get set within docker-compose that contains the custom LOGGING configuration.

...

Contrast to Current Behavior

Currently these changes have to be made to the configuration.py file, instead of being configurable via the docker-compose.overrides.yml file.

...

Discussion: Benefits and Drawbacks

By adding this change it enables much simpler upgrades, all configuration is in a single place (the docker-compose.overrides.yml file), which means when an upgrade is available a simple pull of the latest codebase is all thats required.

...

Changes to the Wiki

...

Proposed Release Note Entry

Enable logging configuration to be set via docker-compose environment variable.

...

Double Check

  • I have read the comments and followed the PR template.
  • I have explained my PR according to the information in the comments.
  • My PR targets the develop branch.

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', }, },}"`
@cimnine
Copy link
Collaborator

cimnine commented Oct 18, 2020

Thank your for this PR. See #318 for the discussion about such dynamic variables and let me know if #343 would be a good enough solution for your use-case.

@cimnine cimnine added enhancement The issue describes an enhancement that we would like to implement in the future. discussion This issue requires further input from the community. labels Oct 18, 2020
@cimnine cimnine closed this Oct 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discussion This issue requires further input from the community. enhancement The issue describes an enhancement that we would like to implement in the future.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants