`DJANGO_DB_LOGGING` setting breaks the build
AetherUnbound opened this issue · comments
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
- Add
DJANGO_DB_LOGGING=true
toapi/.env
- Run
just build
- Observer the above error
Additional context
Likely the result of #4331