How do i log all HTTP/HTTPS traffic from an Axis2 Client?

Axis2 uses Jakart Commons HTTPClient. So you can just use the Context / Wire logging facilities provided by HTTPClient. In example below i set up the Simple logger in an environment variable and use that when i run my client.
C:\TESTING> SET JAVA_OPTS-Dorg.apache.commons.logging.Log=org.apache.commons.logging.impl.SimpleLog -Dorg.apache.commons.logging.simplelog.showdatetime=true -Dorg.apache.commons.logging.simplelog.log.httpclient.wire=debug -Dorg.apache.commons.logging.simplelog.log.org.apache.commons.httpclient=debug
C:\TESTING> java %JAVA_OPTS% MyClient

And the output i got was as follows (munged a bit to protect the innocent):

2006/08/22 22:14:31:531 EDT [DEBUG] HttpConnection - Open connection to api.sandbox.ebay.com:443
2006/08/22 22:15:56:015 EDT [DEBUG] header - >> "POST /wsapi?siteid=0&callname=GeteBayOfficialTime&client=java&appid=XYZ1234 HTTP/1.0[\r][\n]"
2006/08/22 22:15:56:015 EDT [DEBUG] HttpMethodBase - Adding Host request header
2006/08/22 22:15:56:109 EDT [DEBUG] header - >> "SOAPAction: urn:GeteBayOfficialTime[\r][\n]"
2006/08/22 22:15:56:109 EDT [DEBUG] header - >> "User-Agent: Axis2[\r][\n]"
2006/08/22 22:15:56:109 EDT [DEBUG] header - >> "Host: api.sandbox.ebay.com[\r][\n]"
2006/08/22 22:15:56:109 EDT [DEBUG] header - >> "Content-Length: 1546[\r][\n]"
2006/08/22 22:15:56:109 EDT [DEBUG] header - >> "Content-Type: text/xml; charset=UTF-8[\r][\n]"
2006/08/22 22:15:56:109 EDT [DEBUG] header - >> "[\r][\n]"
2006/08/22 22:15:56:109 EDT [DEBUG] content - >> "<?xml version='1.0' encoding='UTF-8'?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Header><ns1:RequesterCredentials xmlns:ns1="urn:ebay:apis:eBLBaseComponents"><ns1:eBayAuthToken>XYZ_ABCD</ns1:eBayAuthToken></ns1:RequesterCredentials></soapenv:Header><soapenv:Body><ns1:GeteBayOfficialTimeRequest xmlns:ns1="urn:ebay:apis:eBLBaseComponents" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ns1:GeteBayOfficialTimeRequestType"><ns1:DetailLevelCodeType>ReturnAll</ns1:DetailLevelCodeType><ns1:ErrorLanguage>en_US</ns1:ErrorLanguage><ns1:Version>427</ns1:Version></ns1:GeteBayOfficialTimeRequest></soapenv:Body></soapenv:Envelope>"
2006/08/22 22:15:56:453 EDT [DEBUG] EntityEnclosingMethod - Request body sent
2006/08/22 22:15:56:578 EDT [DEBUG] header - << "HTTP/1.1 200 OK[\r][\n]"
2006/08/22 22:15:56:578 EDT [DEBUG] header - << "Date: Wed, 23 Aug 2006 02:17:33 GMT[\r][\n]"
2006/08/22 22:15:56:578 EDT [DEBUG] header - << "Server: Microsoft-IIS/5.0[\r][\n]"
2006/08/22 22:15:56:578 EDT [DEBUG] header - << "X-EBAY-API-SERVER-NAME: ZXCVBA[\r][\n]"
2006/08/22 22:15:56:578 EDT [DEBUG] header - << "Content-Type: text/xml;charset=utf-8[\r][\n]"
2006/08/22 22:15:56:578 EDT [DEBUG] header - << "X-Cache: MISS from thrasher.sjc.ebay.com[\r][\n]"
2006/08/22 22:15:56:578 EDT [DEBUG] header - << "Connection: close[\r][\n]"
2006/08/22 22:15:56:609 EDT [DEBUG] content - << "<?xml version="1.0" encoding="UTF-8"?>[\n]"
2006/08/22 22:15:56:609 EDT [DEBUG] content - << "<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">[\n]"
2006/08/22 22:15:56:609 EDT [DEBUG] content - << " <soapenv:Body>[\n]"
2006/08/22 22:15:56:609 EDT [DEBUG] content - << " <GeteBayOfficialTimeResponse xmlns="urn:ebay:apis:eBLBaseComponents">[\n]"
2006/08/22 22:15:56:609 EDT [DEBUG] content - << " <Timestamp>2006-08-23T02:17:33.544Z</Timestamp>[\n]"
2006/08/22 22:15:56:609 EDT [DEBUG] content - << " <Ack>Success</Ack>[\n]"
2006/08/22 22:15:56:609 EDT [DEBUG] content - << " <Version>475</Version>[\n]"
2006/08/22 22:15:56:609 EDT [DEBUG] content - << " <Build>e475_core_Bundled_3434772_R1</Build>[\n]"
2006/08/22 22:15:56:609 EDT [DEBUG] content - << " </GeteBayOfficialTimeResponse>[\n]"
2006/08/22 22:15:56:609 EDT [DEBUG] content - << " </soapenv:Body>[\n]"
2006/08/22 22:15:56:609 EDT [DEBUG] content - << "</soapenv:Envelope>"
2006/08/22 22:15:56:781 EDT [DEBUG] HttpMethodBase - Should close connection in response to directive: close
2006/08/22 22:15:56:781 EDT [DEBUG] HttpConnection - Releasing connection back to connection manager.
library project main code
Learn Cloud
Learn
Cloud

The WSO2 Application Server is a reliable application server that can host your enterprise web applications. The WSO2 Application Server as a Service is offered in StratosLive, the WSO2 Platform as a Service. This article explains how a simple web application can be developed and deployed from Carbon Studio to the WSO2 Application Server...

Latest Webinar
Different groups within an organization need to monitor different Key Performance Indicators (KPIs) - An operations team will be interested in the response times of business services and loads of each service,..
Thursday, February 9th 2012, 09.00 AM (PST)

Thursday, February 9th 2012, 10.00 AM (GMT)