JsonLogging format
See original GitHub issueHi folks, could be possible a Json format logger? i’m using elasticsearch to log data, and json is very intuitive there’s a logger but i don’t know how to use it with uvicorn:
from pythonjsonlogger.jsonlogger import JsonFormatter
JsonFormatter("(asctime) (levelname) (name) (module) (funcName) (lineno) (message)")
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
JSON Logging Best Practices - Loggly
JSON logging is a kind of structured logging, Meaning you'll have your log data parsed and stored in a structured JSON format. Why...
Read more >JSON Logging: What, Why, How, & Tips - Coralogix
There is no standard format for JSON logs – just the JSON syntax – so you can decide on a structure to serve...
Read more >8 Essential Tips for JSON logging - Papertrail
The JSON format is ubiquitous and used everywhere from logging in web apps to message passing for microcontrollers. Thanks to its compact nature...
Read more >Format for writing a JSON log file? - Stack Overflow
That log format is called JSON-lines by various logging apps. Logstash for example: elastic.co/guide/en/logstash/current/… – Mnebuerquo. Mar 28, ...
Read more >JSON Well Log Format
The log header contains metadata that describes the overall logging operation and consists of any JSON objects and arrays that the producing entity...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This is something that I do in all of my projects. Currently, I am running gunicorn with the uvicorn worker and passing a custom logfile like so:
The
logging_config.conf
looks like this:Note that for high throughput, the uvicorn docs mention turning off access logging, which I have not done here.
Hello all, since it looks like this is mostly a logging configuration question and that some solutions were provided above, I’m going to close this off for housekeeping purposes. Thanks!