ValueError: Unable to configure filter "'request_id'"

1.8k views Asked by At

I was trying to run the python3.8 manage.py runserver

Im having the request_id defined in INSTALLED_APPS and request_id.middleware.RequestIdMiddleware added in MIDDLEWARE under setting.py

This is the traceback

> Exception ignored in thread started by: <function
> check_errors.<locals>.wrapper at 0x7fe56c1d78b0> Traceback (most
> recent call last):   File
> "/usr/lib/python3/dist-packages/django/utils/autoreload.py", line 228,
> in wrapper
>     fn(*args, **kwargs)   File "/usr/lib/python3/dist-packages/django/core/management/commands/runserver.py",
> line 116, in inner_run
>     autoreload.raise_last_exception()   File "/usr/lib/python3/dist-packages/django/utils/autoreload.py", line 251,
> in raise_last_exception
>     six.reraise(*_exception)   File "/usr/lib/python3/dist-packages/django/utils/six.py", line 685, in
> reraise
>     raise value.with_traceback(tb)   File "/usr/lib/python3/dist-packages/django/utils/autoreload.py", line 228,
> in wrapper
>     fn(*args, **kwargs)   File "/usr/lib/python3/dist-packages/django/__init__.py", line 22, in setup
>     configure_logging(settings.LOGGING_CONFIG, settings.LOGGING)   File "/usr/lib/python3/dist-packages/django/utils/log.py", line 75, in
> configure_logging
>     logging_config_func(logging_settings)   File "/usr/lib/python3.8/logging/config.py", line 808, in dictConfig
>     dictConfigClass(config).configure()   File "/usr/lib/python3.8/logging/config.py", line 553, in configure
>     raise ValueError('Unable to configure ' ValueError: Unable to configure filter 'request_id'

Im running this using python3.8 but not sure why python3 is referred in traceback.

Update: Adding the relevant lines from settings.py

LOGGING = {
    "filters": {
        "request_id": {
            "()": "request_id_django_log.filters.RequestIDFilter"
            },
        },
}
2

There are 2 answers

0
user20930049 On

Similar fix for me as with DilLip_Chowdary, but I think there was some kind of name change

pip install django-request-id 

Tested on django==3.2.3

0
DilLip_Chowdary On

Installing django-log-request-id can fix this issue.

pip install django-log-request-id

I've tested this in django==2.2.2