Logging incoming and outgoing HTTP REST request/response in Spring/Tomcat
<p>I have a Spring REST service and sometimes when I request the REST service I get a HTTP 401. I am looking to investigate this issue, this is intermittent and does not happen at all times. (It is the same request that I send everytime).  I also have swagger integrated to provide REST documentation. 
I am deploying my spring REST services as a webapp to Tomcat 7.</p>

<ol>
<li><p>How can I log the incoming and outgoing HTTP requests even if the request is an unauthenticated request.  I want to be able to tie in ALL the incoming request and their corresponding outgoing response. This is something I would like to roll out into the production application as well.</p></li>
<li><p>What best practices can I adopt in terms of logging for REST services in Spring, any features I can use that Spring or Tomcat offers for better logging and investigation?</p></li>
</ol>

<p>Thanks</p>