Поправить try except в логере, добавить AttributeError
Если лог будет вызван до установки контекста, возникнет исключение AttributeError
billing-service_1 | File "/usr/local/lib/python3.9/asyncio/base_events.py", line 1521, in create_server
billing-service_1 | logger.info("%r is serving", server)
billing-service_1 | File "/usr/local/lib/python3.9/logging/__init__.py", line 1442, in info
billing-service_1 | self._log(INFO, msg, args, **kwargs)
billing-service_1 | File "/usr/local/lib/python3.9/logging/__init__.py", line 1585, in _log
billing-service_1 | self.handle(record)
billing-service_1 | File "/usr/local/lib/python3.9/logging/__init__.py", line 1595, in handle
billing-service_1 | self.callHandlers(record)
billing-service_1 | File "/usr/local/lib/python3.9/logging/__init__.py", line 1657, in callHandlers
billing-service_1 | hdlr.handle(record)
billing-service_1 | File "/usr/local/lib/python3.9/logging/__init__.py", line 944, in handle
billing-service_1 | rv = self.filter(record)
billing-service_1 | File "/usr/local/lib/python3.9/logging/__init__.py", line 802, in filter
billing-service_1 | result = f.filter(record)
billing-service_1 | File "/usr/local/lib/python3.9/site-packages/prozorro_sale/tools/logging.py", line 22, in filter
billing-service_1 | request_id = context.get('X-Request-ID')
billing-service_1 | File "/usr/local/lib/python3.9/site-packages/aiotask_context/__init__.py", line 116, in get
billing-service_1 | return current_task.context.get(key, default)
billing-service_1 | AttributeError: '_asyncio.Task' object has no attribute 'context'
Edited by Pavel Kuzmenko