Bug
When body.contentLength() exceeds maxLoggableRequestSize, the code attempts to truncate bodyString. This fails when the actual bodyString.length() is less than the maxLoggableRequestSize.
Fix
Check bodyString length instead of body.contentLength().