I want to log each HTTP request and response (for debugging/development) within play 2 (2.0 for now, but I'am willing to switch to 2.X once available; Preferred language is Scala).
I found I can use onRouteRequest to get hold of the requestHeader, but this misses the body.
ActionComposition may be an alternative, but this also does not seem to be the plain request.
Getting hold of the HTTP Response seems to be even more complicated. Obviously it would be nice to customize/truncate logging based on the content-type to avoid logging of image/binary data.
Response Logging should also work with Async Results.
You could make use of filters (a new feature introduced in Play 2.1). Check out http://www.playframework.com/documentation/2.1.1/ScalaHttpFilters at "More powerful filters"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With