json-logging-python
json-logging-python copied to clipboard
pull changes from SAP/cf-python-logging-support add support for Django and Falcon
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
Is it better to do this in this module, or another that uses json_logging.register_framework_support
.
Whether in this package or another, the way to make it easy for a Django developer is to use a Django middleware and the LOGGING_CONFIG setting which can pre-process the dictionary usually passed to logging.dictConfig
.
This would look like this in a Django settings file:
MIDDLEWARE = [
'logging_config.framework.django.RequestResponseMiddleware',
# ... rest of middleware
]
LOGGING_CONFIG='json_logging.framework.django.config_logging'
And then the LOGGING_CONFIG
callable would do the required wiring:
def configure_logging(logging_dict):
logging.dictConfig(logging_dict)
json_logging.ENABLE_JSON_LOGGING = True
json_logging.init_django()
@danizen yeah, we can leverage the register_framework_support to add django support. PR is welcomed!
@thangbn, I have a broken wrist right now. I code slow until healed. But wait a month or so.
I've also been wondering about the correlation id, and auto headers added in the cloud. If you are running behind an AWS ALB, it will send X-Amzn-Trace-Id. But this has an internal structure. I'm not sure whether this module makes a requirement on the structure of the Correlation ID header (e.g. UUID or something).
@danizen Sorry to hear that, hope you have a speedy recovery. sure that is something i can look into, i also plan to support custom list of headers to be logged together with correlation-id (e.g trace id, span id used by opentracing)
@thangbn , @danizen are there any plans on completing this any time soon, or should I rather try tackling this myself from scratch?
@kshpytsya i really dont have time to to this, you are very welcome to create a PR, it should relatively straight forward to do. Thanks in advance.
Hi, is this still being worked on? I'd love to contribute as I really need Django support but I'm kind of a python beginner, so I don't even have a clue where to start...
Hi, is this still being worked on? I'd love to contribute as I really need Django support but I'm kind of a python beginner, so I don't even have a clue where to start...
Feel free to submit it, we can all improve it together. no worries