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

DJANGO_DB_LOGGING setting breaks the build #4347

Closed
AetherUnbound opened this issue May 16, 2024 · 0 comments · Fixed by #4351
Closed

DJANGO_DB_LOGGING setting breaks the build #4347

AetherUnbound opened this issue May 16, 2024 · 0 comments · Fixed by #4351
Assignees
Labels
💻 aspect: code Concerns the software code in the repository 🛠 goal: fix Bug fix 🟧 priority: high Stalls work on the project or its dependents 🧱 stack: api Related to the Django API

Comments

@AetherUnbound
Copy link
Contributor

Description

Setting DJANGO_DB_LOGGING=true in api/.env breaks the Docker build (and service start) with the following error:

> [web api 13/13] RUN env   SETUP_ES="False"   DJANGO_SECRET_KEY="any string"   CANONICAL_DOMAIN=""   python manage.py collectstatic:
1.778 Traceback (most recent call last):
1.778   File "/usr/local/lib/python3.11/logging/config.py", line 783, in add_handlers
1.778     logger.addHandler(self.config['handlers'][h])
1.778                       ~~~~~~~~~~~~~~~~~~~~~~~^^^
1.779   File "/usr/local/lib/python3.11/logging/config.py", line 336, in __getitem__
1.779     value = dict.__getitem__(self, key)
1.779             ^^^^^^^^^^^^^^^^^^^^^^^^^^^
1.779 KeyError: 'console'
1.779 
1.779 The above exception was the direct cause of the following exception:
1.779 
1.779 Traceback (most recent call last):
1.779   File "/usr/local/lib/python3.11/logging/config.py", line 627, in configure
1.779     self.configure_logger(name, loggers[name])
1.779   File "/usr/local/lib/python3.11/logging/config.py", line 808, in configure_logger
1.779     self.common_logger_config(logger, config, incremental)
1.779   File "/usr/local/lib/python3.11/logging/config.py", line 800, in common_logger_config
1.779     self.add_handlers(logger, handlers)
1.779   File "/usr/local/lib/python3.11/logging/config.py", line 785, in add_handlers
1.779     raise ValueError('Unable to add handler %r' % h) from e
1.779 ValueError: Unable to add handler 'console'
1.779 
1.779 The above exception was the direct cause of the following exception:
1.779 
1.779 Traceback (most recent call last):
1.779   File "/api/manage.py", line 29, in <module>
1.779     main()
1.779   File "/api/manage.py", line 25, in main
1.779     execute_from_command_line(sys.argv)
1.779   File "/.venv/lib/python3.11/site-packages/django/core/management/__init__.py", line 442, in execute_from_command_line
1.779     utility.execute()
1.779   File "/.venv/lib/python3.11/site-packages/django/core/management/__init__.py", line 416, in execute
1.779     django.setup()
1.779   File "/.venv/lib/python3.11/site-packages/django/__init__.py", line 19, in setup
1.779     configure_logging(settings.LOGGING_CONFIG, settings.LOGGING)
1.779   File "/.venv/lib/python3.11/site-packages/django/utils/log.py", line 76, in configure_logging
1.780     logging_config_func(logging_settings)
1.780   File "/usr/local/lib/python3.11/logging/config.py", line 823, in dictConfig
1.780     dictConfigClass(config).configure()
1.780   File "/usr/local/lib/python3.11/logging/config.py", line 629, in configure
1.780     raise ValueError('Unable to configure logger '
1.780 ValueError: Unable to configure logger 'django.db.backends'
------
failed to solve: process "/bin/sh -c env   SETUP_ES=\"False\"   DJANGO_SECRET_KEY=\"any string\"   CANONICAL_DOMAIN=\"\"   python manage.py collectstatic" did not complete successfully: exit code: 1

Removing this setting lets the build proceed, but prevents being able to log database queries as was previously possible.

Reproduction

  1. Add DJANGO_DB_LOGGING=true to api/.env
  2. Run just build
  3. Observer the above error

Additional context

Likely the result of #4331

@AetherUnbound AetherUnbound added 💻 aspect: code Concerns the software code in the repository 🛠 goal: fix Bug fix 🟧 priority: high Stalls work on the project or its dependents 🧱 stack: api Related to the Django API labels May 16, 2024
@dhruvkb dhruvkb self-assigned this May 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
💻 aspect: code Concerns the software code in the repository 🛠 goal: fix Bug fix 🟧 priority: high Stalls work on the project or its dependents 🧱 stack: api Related to the Django API
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants