odoo-cloud-platform
odoo-cloud-platform copied to clipboard
Enhanced JSON Logging
Hi guys. I've done some work on the logging_json module to make the output easier to work with in logging tools. There are two main changes:
- The "perf_info" string field is now split into numeric
response_time,query_countandquery_timefields - I've overridden Odoo's
RequestHandler.log_request()method to log out all the request info as seperate fields instead of one big long string:
Before:
{
"asctime": "2020-02-16 02:59:19,598",
"pid": 14298,
"levelname": "INFO",
"dbname": "odoo13",
"name": "werkzeug",
"message": "192.168.56.1 - - [16/Feb/2020 02:59:19] \"GET /web/image?model=res.partner&field=image_128&id=3&unique= HTTP/1.1\" 304 -",
"perf_info": "5 0.085 0.156"
}
After:
{
"asctime": "2020-02-16 02:53:00,716",
"pid": 13919,
"levelname": "INFO",
"dbname": "odoo13",
"name": "werkzeug",
"message": "request",
"method": "GET",
"path": "/web/image?model=res.partner&field=image_128&id=9",
"http_ver": "HTTP/1.1",
"http_code": "404",
"size": "-",
"client_addr": "192.168.56.1",
"response_time": 0.538973,
"query_count": 6,
"query_time": 0.065994
}
Obviously this is a breaking change, so I guess we might want a flag to enable it, maybe by setting ODOO_LOGGING_JSON env var to "enhanced"? I'm open to suggestions :)
Thanks for this great collection of modules! - I'm looking forward to implementing them for our customers :)
...As a side note, this also removes perf_info from non-http log entries (which never have it set)
Before:

After:

References:
What happens to these type of PRs? git-aggregator?
There hasn't been any activity on this pull request in the past 4 months, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 30 days. If you want this PR to never become stale, please ask a PSC member to apply the "no stale" label.