- Issue created by @smokris
- Issue was unassigned.
- Status changed to Needs review
about 1 year ago 5:58pm 5 October 2023 - last update
about 1 year ago 27 pass
PSR-3 specifies that exception objects should be stored in the context's exception
key. Currently jsonlog ignores this key, so the exception data is lost, instead of being included in JSON log messages.
This command…
drush eval '\Drupal::logger("test_logger")->error("test message", ["exception" => new \Exception("test exception")]);'
…outputs this JSON log…
{"@timestamp":"2023-10-05T17:19:09.161Z","@version":1,"message":"test message","message_id":"d10test651ef00d2741c4.46456678","site_id":"d10test","canonical":"","method":"GET","tags":null,"type":"drupal","subtype":"test_logger","severity":"Error","request_uri":"https:\/\/d10test.ddev.site\/","referer":"","uid":0,"username":"","client_ip":"127.0.0.1","link":null,"code":0,"trunc":""}
…which lacks the "test exception" string and other info from the \Exception
object.
Include the exception data in the JSON log message as a new "exception"
key.
Review patch.
n/a
n/a
n/a
Needs review
4.0
Code