microsoft / promptflow

Build high-quality LLM apps - from prototyping, testing to production deployment and monitoring.
https://microsoft.github.io/promptflow/
MIT License
9.59k stars 878 forks source link

[Feature Request] JSON formatted Logs #3292

Open camilla11 opened 6 months ago

camilla11 commented 6 months ago

Is your feature request related to a problem? Please describe. We are exporting logs to datadog, and would like exceptions to show up in a single log line. Via the Datadog guidelines, this requires that logs be output in JSON format https://www.datadoghq.com/blog/python-logging-best-practices/#log-in-json-format. We can configure the format of logs in our custom code but the log format for logs from the promptflow executor or serving app use their own format and re https://github.com/microsoft/promptflow/issues/2852 we can only change format (I'm unsure if we can use this to resemble JSON, especially in exceptions)

Describe the solution you'd like Ability to specify log formatter library for logs. For example https://github.com/madzak/python-json-logger or https://pypi.org/project/JSON-log-formatter/

Describe alternatives you've considered Using the new feature above to resemble JSON Trying to hook into Flask handlers like: @app.errorhandler(400) and @app.errorhandler(Exception) with no luck

Additional context Add any other context or screenshots about the feature request here.

aaronjolson commented 4 months ago

I also have this same issue and would really appreciate this feature.