Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pull changes from SAP/cf-python-logging-support add support for Django and Falcon #27

Open
bobbui opened this issue Jul 20, 2019 · 8 comments

Comments

@bobbui
Copy link
Owner

bobbui commented Jul 20, 2019

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

@danizen
Copy link

danizen commented Oct 11, 2019

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()

@bobbui
Copy link
Owner Author

bobbui commented Oct 12, 2019

@danizen yeah, we can leverage the register_framework_support to add django support. PR is welcomed!

@danizen
Copy link

danizen commented Oct 21, 2019

@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).

@bobbui
Copy link
Owner Author

bobbui commented Oct 21, 2019

@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)

@kshpytsya
Copy link

@thangbn , @danizen are there any plans on completing this any time soon, or should I rather try tackling this myself from scratch?

@bobbui
Copy link
Owner Author

bobbui commented Jul 27, 2020

@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.

@obvionaoe
Copy link

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...

@bobbui
Copy link
Owner Author

bobbui commented Nov 12, 2021

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants