json-logging-python
json-logging-python copied to clipboard
Cloud-native distributed Python logging library to emit JSON log that can be easily indexed by logging infrastructure
Code: ``` app = FastAPI( title='Service', version=__version__, ) @app.on_event("startup") def startup_event(): print('Will configure logging now') json_logging.init_fastapi(enable_json=True) logger = logging.getLogger() syslog = logging.StreamHandler(sys.stdout) logger.addHandler(syslog) ``` Every log now has this error:...
how can gunicorn flask and json-logging-python combine together? can you show me an example? ``` gunicorn.conf.py bind = '0.0.0.0:%i' % int(os.getenv('PORT', 5000)) backlog = int(os.getenv('GUNICORN_BACKLOG', 2048)) # # Worker processes...
Hi, great package! Could it made possible to set the User (like correlation-Id)? Background is that I'm in a situation where I orchestrate some microservices (in my case with Fastapi)...
Is the custom formatter compatible with bottlepy framework and gevent server?
https://github.com/SAP/cf-python-logging-support have a quite similar setup in term of adding framework support. We can pull Django and Falcon support from https://github.com/SAP/cf-python-logging-support/tree/master/sap/cf_logging/django_logging and https://github.com/SAP/cf-python-logging-support/tree/master/sap/cf_logging/falcon_logging to json_logging
I'm interested in getting the request body in a custom request formatter when using FastAPI. However, `request.body()` returns a coroutine and therefore requires the `await` keyword, but the `_format_log_object` method...
`class TestLog(json_logging.JSONLogWebFormatter): def _format_log_object(self, record, request_util): json_log_object = super(TestLog, self)._format_log_object(record, request_util) json_log_object.update({ "message": _sanitize_log_msg(record), "lineno": record.lineno, "TraceId": request_util.get_correlation_id(within_formatter=True), "log_type": "desc" }) return json_log_object` use flask web framework, Failed to customize...
Would be awesome if you could add framework support for celery so that all of the celery log handlers got handled and wrapped in JSON.
I am running into an issue with the logger implementation throwing the following error: ``` --- Logging error --- Traceback (most recent call last): File "/usr/local/lib/python3.9/logging/__init__.py", line 1083, in emit...
Recently upgrading to use connexion 3.0.1, and see a failure. File "json_logging/framework/connexion/__init__.py", line 53, in before_request if is_not_match_any_pattern(_current_request.path, exclude_url_patterns): File "python3.10/site-packages/connexion/lifecycle.py", line 243, in __getattr__ return getattr(self._starlette_request, item) AttributeError: 'Request'...