title: How to enable wire logging for a java HttpURLConnection traffic?
body: <p>I've used <a href="http://hc.apache.org/httpclient-3.x/index.html" rel="noreferrer">Jakarta commons HttpClient</a> in another project and I would like the same <a href="http://hc.apache.org/httpclient-3.x/logging.html" rel="noreferrer">wire logging</a> output but using the "standard" HttpUrlConnection.</p>
  
  <p>I've used <a href="http://www.fiddler2.com/fiddler2/" rel="noreferrer">Fiddler</a> as a proxy but I would like to log the traffic directly from java.</p>
  
  <p>Capturing what goes by the connection input and output streams is not enough because the HTTP headers are written and consumed by the HttpUrlConnection class, so I will not be able to log the headers.</p>