+

Search Tips   |   Advanced Search

Configure Cross Component Trace (XCT)

XCT annotates the logs so that log entries related to a request that is serviced by more than one thread, process, or even server are identified as belonging to the same unit of work. We can configure XCT using the dmgr console, or using wsadmin.sh. If we complete this task using the deployment manager, synchronize the node agent on the target node and restart the server before configuration changes take effect.


Enable using console

  1. In the WebSphere admin console, expand...

      Troubleshooting > Logging and tracing

  2. Select the component to enable Cross Component Tracing (XCT) on, such as an application server, node, or deployment manager.

  3. Select Change log detail levels.

  4. Check Enable log and trace correlation and select one of the three bullets.

    • Include request IDs in log and trace records
    • Include request IDs in log and trace records and create correlation log records
    • Include request IDs in log and trace records, create correlation log records, and capture data snapshots

  5. Select OK.

  6. Select Save.

Include request IDs in log and trace files to see which log and trace entries, in all threads and application server processes, are related to the same request. Request IDs are only recorded when using HPEL log and trace mode and can be seen or used for filtering using the logViewer command.

Create correlation log records to log how requests branch between threads and processes, and see extra information about each request. Enabling XCT to create correlation log records might have a significant performance impact on the system, so is best suited to test and development environments.

Capture data snapshots to store entire request and response bodies to the file system. Enabling XCT to capture data snapshots might have a significant performance impact on the system, so is best suited to test and development environments. XCT captures data snapshots for message requests and responses handled by the SIBus.

Data snapshots are captured and written to...


Enable using wsadmin

Use the AdminConfig object to configure XCT.

Changes made using the AdminConfig object take effect after server restart.

  1. Enable XCT for the server.

    By default, XCT is disabled for the server. The following example shows how to enable XCT for the server when the server is using HPEL log and trace mode. Specify RASLoggingService instead of HighPerformanceExtensibleLogging when the server is using basic log and trace mode. Specify false instead of true to disable XCT.

      # Get rid of existing property if already present
      configId = AdminConfig.getid("/Cell:myCell/Node:myNode/Server:myServer/HighPerformanceExtensibleLogging:/Property:com.ibm.websphere.logging.enableCorrelation")
      if (len(configId) > 0): AdminConfig.remove(configId)

      # Add new property
      LoggingService = AdminConfig.getid("/Cell:myCell/Node:myNode/Server:myServer/HighPerformanceExtensibleLogging:/")
      AdminConfig.create("Property", LoggingService, [["name", "com.ibm.websphere.logging.enableCorrelation"],["value", "true"]])
      AdminConfig.save()

  2. Change the log setting for XCT .

    By default, the XCT log setting includes request IDs in log and trace files. The following example shows how to make XCT both include request IDs in log and trace files and log XCT log records. Specify REQUEST ID instead of LOG to make XCT only include request IDs in log and trace files. Specify DATA_SNAPSHOT instead of LOG to make XCT include request IDs in log and trace files, log XCT log records, and capture data snapshots. Specify RASLoggingService instead of HighPerformanceExtensibleLogging when the server is using basic log and trace mode.

    # get rid of existing property if already present
    configId = AdminConfig.getid("/Cell:myCell/Node:myNode/Server:myServer/HighPerformanceExtensibleLogging:/Property:com.ibm.websphere.logging.correlationLevel") 
    if (len(configId) > 0): AdminConfig.remove(configId)
    # add new property LoggingService = AdminConfig.getid("/Cell:myCell/Node:myNode
    Server:myServer/HighPerformanceExtensibleLogging:/")
    AdminConfig.create("Property", LoggingService, [["name", "com.ibm.websphere.logging.correlationLevel"],["value", "LOG"]])
    
    AdminConfig.save()


Use the AdminControl object to configure XCT

Changes made using the AdminControl object take effect immediately.

  1. Enable XCT for the server.

    By default, XCT is disabled for the server. The following example shows how to enable XCT for the server when the server is using HPEL log and trace mode. Ensure the server is running and specify RasLoggingService instead of HPELControlService when the server is using basic log and trace mode. Specify false instead of true to disable XCT.

      LoggingMBean = AdminControl.queryNames('cell=myCell,node=myNode, type=HPELControlService,process=myServer,*')
      AdminControl.setAttribute(LoggingMBean, "correlationEnabled", "true")

  2. Change the log setting for XCT .

    By default, the XCT log setting includes request IDs in log and trace files. The following example shows how to make XCT both include request IDs in log and trace files and log XCT log records. Specify REQUEST ID instead of LOG to make XCT only include request IDs in log and trace files. Specify DATA_SNAPSHOT instead of LOG to make XCT include request IDs in log and trace files, log XCT log records, and capture data snapshots. Ensure the server is running and specify RasLoggingService instead of HPELControlService when the server is using basic log and trace mode.

      LoggingMBean = AdminControl.queryNames('cell=myCell,node=myNode,type=HPELControlService,process=myServer,*') AdminControl.setAttribute(LoggingMBean, "xctLevel", "LOG")


Results

XCT is now configured. If we made changes with the AdminConfig command, restart the server to make the changes take effect.


Related concepts:
Cross Component Trace (XCT) Overview
Use Cross Component Trace to troubleshoot applications
Use wsadmin AdminConfig object
LogViewer command-line tool


+

Search Tips   |   Advanced Search