Logging and Debug Tracing for CXF based Web Services
search cancel

Logging and Debug Tracing for CXF based Web Services

book

Article ID: 266012

calendar_today

Updated On:

Products

CA Service Management - Service Desk Manager CA Service Desk Manager

Issue/Introduction

Since 17.3 RU19, the new CXF based Web Services have been added for CA Service Desk Manager (SDM).

The following document describes how to enable extended logging/tracing to investigate any issues leveraging SOAP Web Services.

Environment

CA Service Desk Manager 17.3 RU19 or higher

All Supported Operating Systems

Resolution

There are two methods that can be followed to enable additional logging of CXF based web services.

Method 1:  Modify cxf-beans.xml

This approach will expose both inbound and outbound SOAP calls that are being made over CXF web services along with some supporting context for the calls being issued.

Caution: This method may result in large pdm_tomcat.log file output.  It is strongly advised to utilise this method under Support supervision.

  1. On the SDM server where CXF Web Services are deployed, backup, then open the following file for editing with a text editor, file cxf-beans.xml located in NX_ROOT\bopcfg\www\CATALINA_BASE\webapps\cxf\WEB-INF\

  2. Search for the tag "jaxws:features"

  3. There will be the following content located:
            <jaxws:features>
              <!--bean class="org.apache.cxf.feature.LoggingFeature" /-->
          </jaxws:features>
  4. Remove the above comment so the entry reads as:
            <jaxws:features>
              <bean class="org.apache.cxf.feature.LoggingFeature" />
          </jaxws:features>
  5. Save the changes to the file

  6. Recycle the main SDM Tomcat process or recycle the SDM services


Additional logging will be written to the pdm_tomcat.log under NX_ROOT/log

 

Method 2:  Modify log4j2.xml

  1. On the SDM server where CXF Web Services are deployed, backup, then open the following file for editing with a text editor, file log4j2.xml, located in NX_ROOT\bopcfg\www\CATALINA_BASE\webapps\cxf\WEB-INF\classes

  2. Locate the following block of text and change as follows (change highlighted in bold):

    Original:
        <Root level="INFO" additivity="false">
          <AppenderRef ref="RollingFile"/>
      </Root>

    Modified:
        <Root level="DEBUG" additivity="false">
          <AppenderRef ref="RollingFile"/>
      </Root>
  3. Save the changes to the file

  4. Recycle the main SDM Tomcat process or recycle the SDM services

Log file of interest is the jsrvr.log located in the designated Tomcat install directory, eg:  C:\Program Files (x86)\CA\SC\tomcat\9.0.86\logs.  The jsrvr.log located in NX_ROOT\log will NOT contain any debug level content.

 
Additional option for log4j2.xml (SDM 17.4 RU4 and above)

This approach will expose both inbound and outbound SOAP calls that are being made over CXF web services.

  1. Backup, then edit the NX_ROOT\bopcfg\www\CATALINA_BASE\webapps\cxf\WEB-INF\classes\log4j2.xml file.  Locate and uncomment this section, around lines 31-35

            <Logger name="com.broadcom.casm.sdm.jws.handlers.SOAPMessageHandler" additivity="false" level="DEBUG">
                <AppenderRef ref="RollingFile" />
          </Logger>
  2. Save, and recycle Tomcat or SDM Services

Log file of interest is the jsrvr.log, located under NX_ROOT/log

Additional Information

These instructions are applicable only for CXF SOAP web services and not for Axis SOAP web services, which was deprecated and removed as of 17.4 RU5.

The above logging should only be activated for purposes of debug and tracing as this logging is highly resource intensive.

For 17.4 RU4 instances, to enable logging for only incoming or outgoing SOAP calls and not both, please review Monitor incoming or outgoing CXF SOAP payload in CA Service desk Manager.  To avoid confusion, please use either this article or the article in the given doc link, and not both at once.

While both of the above methods can be activated simultaneously (cxf-beans.xml or log4j2.xml), it is advised to utilise only one or the other approach listed in this article, depending on requirements. 

Both methods also have the potential to expose sensitive content as SOAP messages are logged via this approach.  To illustrate, the following is sample content from the pdm_tomcat.log and jsrvr.log (17.4 RU4 and higher) collected while both had debug tracing activated and a web services call was made for login to Service Desk, returning SID value 1643659535.

Sample pdm_tomcat.log:

Feb 23, 20XX 8:25:39 PM org.apache.cxf.services.USD_WebService.USD_WebServiceSoap.USD_WebServiceSoap
INFO: Inbound Message
----------------------------
ID: 1
Address: http://localhost:8080/cxf/services/USD_WebService
Encoding: UTF-8
Http-Method: POST
Content-Type: text/xml;charset=UTF-8
Headers: {accept-encoding=[gzip,deflate], connection=[Keep-Alive], Content-Length=[344], content-type=[text/xml;charset=UTF-8], host=[localhost:8080], SOAPAction=["login"], user-agent=[Apache-HttpClient/4.5.5 (Java/17.0.12)]}
Payload: <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ser="http://www.ca.com/UnicenterServicePlus/ServiceDesk">
   <soapenv:Header/>
   <soapenv:Body>
      <ser:login>
         <username>XXXX</username>
         <password>XXXX</password>
      </ser:login>
   </soapenv:Body>
</soapenv:Envelope>
--------------------------------------
Feb 23, 20XX 8:25:43 PM org.apache.cxf.services.USD_WebService.USD_WebServiceSoap.USD_WebServiceSoap
INFO: Outbound Message
---------------------------
ID: 1
Response-Code: 200
Encoding: UTF-8
Content-Type: multipart/related; type="application/xop+xml"; boundary="uuid:XXXX-XXXX-XXXX-XXXX-XXXX"; start="<[email protected]>"; start-info="text/xml"
Headers: {}
Payload: 
--uuid:XXXX-XXXX-XXXX-XXXX-XXXX
Content-Type: application/xop+xml; charset=UTF-8; type="text/xml"
Content-Transfer-Encoding: binary
Content-ID: <[email protected]>

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><ns2:loginResponse xmlns:ns2="http://www.ca.com/UnicenterServicePlus/ServiceDesk"><loginReturn>1643659535</loginReturn></ns2:loginResponse></soap:Body></soap:Envelope>
--uuid:XXXX-XXXX-XXXX-XXXX-XXXX--
--------------------------------------

 

Sample jsrvr.log:

02/23 20:25:43.699 [pool-5-thread-1] INFO  bop_logging 468 02/23 20:25:43.699 Sending Msg
From: agent_intf_javaSDMSERVER.BPMessageCatcher [BPMessageCatcher -401932288BPMessageCatcher]
To: 3048|BOP-LOGIN|validate_user
BPMessage
{
   method = validate_user
   arg 0 = (string) [OMITTED]
   arg 1 = (int) 1
   arg 2 = (string) domsrvr
   arg 3 = (int) 3
   arg 4 = (int) 22000
   reply object = agent_intf_javaSDMSERVER.BPMessageCatcher [BPMessageCatcher -401932288BPMessageCatcher]
   reply method = 785585782
}
 
02/23 20:25:43.700 [TCP_port-Write:Slump_nxd] DEBUG TCP_port 1850 Processing write queue 

02/23 20:25:43.770 [TCP_port-Read:Slump_nxd] DEBUG BPObject 335 Received BPMessage for BPObject agent_intf_javaSDMSERVER.BPMessageCatcher 

02/23 20:25:43.770 [TCP_port-Read:Slump_nxd] INFO  bop_logging 468 02/23 20:25:43.770 Received Msg [User XXXX; Session 1643659535]
From: BOP-LOGIN.
To: agent_intf_javaSDMSERVER.BPMessageCatcher [BPMessageCatcher -401932288BPMessageCatcher]
BPMessage
{
   method = 785585782
   arg 0 = (string) cnt:XXXXXXXXXXXXXXXX
   arg 1 = (int) 1
   arg 2 = (int) 1643659535
   arg 3 = (object) 3048|domsrvr|2DIAAA 2DIAAA
}