Logging and tracing in WebSphere Application Server Community Edition

To turn on logging and tracing for IMS™ TM resource adapter information in WebSphere® Application Server Community Edition, set the trace output to a file or the memory buffer, and specify the log level for the packages that contain IMS TM resource adapter information.

About this task

To print out the logging and tracing information for the IMS TM resource adapter:

Procedure

  1. Open the logging.properties file. This file is located in the JAVA_HOME/jre/lib directory. For example: C:\Program Files\IBM\Java60\jre\lib.

    The Java home directory can be identified by examining the java.home property in the WebSphere Application Server Community Edition administrative console, under the Java System Info section.

  2. Specify the logging level for IMS TM resource adapter by adding the com.ibm.j2ca.RAIMSTM.level setting and set it to FINEST:
    com.ibm.j2ca.RAIMSTM.level=FINEST
  3. By default, the console handler is enabled, but not the file handler. Ensure that the file handler is enabled by uncommenting the following line:
    handlers= java.util.logging.FileHandler
  4. By default, the XML formatter is used for viewing the log. Alternatively, you can use the simple formatter. To change to the simple formatter, uncomment the default XML formatter and add a line to use the simple formatter:
    //java.util.logging.FileHandler.formatter = java.util.logging.XMLFormatter
    java.util.logging.FileHandler.formatter = java.util.logging.SimpleFormatter 
  5. Restart the WebSphere server.
  6. Run your Java™ application and then examine the trace file. The trace file, by default, is located in WASCE_HOME/var/temp directory, as defined by this line in the logging.properties file:
    java.util.logging.FileHandler.pattern = %t/java%u.log
    For example, C:\Program Files\IBM\WebSphere\AppServerCommunityEdition\var\temp\java0.log.
    Alternatively you can specify the log file in the geronomi-ra.xml file under the <resourceadapter-instance> section. For example:
    <resourceadapter-instance>
      <!-- Specify a name for the resource adapter  -->
      <resourceadapter-name>IMSTMRA</resourceadapter-name>
        <config-property-setting name="traceFilename">imsico-trace.log</config-property-setting>
    This configuration puts the imsico-trace.log file under WASCE_HOME\bin\logs\, for example, C:\Program Files\IBM\WebSphere\AppServerCommunityEdition\bin\logs\imsico-trace_x.log.

Results

The following are sample outputs from the XML formatter, simple formatter, and the IMS TM resource adapter log file specified in the geronomi-ra.xml file:
  • XML formatter
    <?xml version="1.0" encoding="GBK" standalone="no"?>
    <!DOCTYPE log SYSTEM "logger.dtd">
    <log>
    <record>
      <date>2012-01-18T10:11:27</date>
      <millis>1326852687578</millis>
      <sequence>0</sequence>
      <logger>com.ibm.j2ca.RAIMSTM</logger>
      <level>FINER</level>
      <class>com.ibm.j2ca.base.WBIResourceAdapter</class>
      <method>start(BootstrapContext)</method>
      <thread>10</thread>
      <message>Entering method.</message>
    </record>
    <record>
      <date>2012-01-18T10:11:27</date>
      <millis>1326852687640</millis>
      <sequence>1</sequence>
      <logger>com.ibm.j2ca.RAIMSTM</logger>
      <level>INFO</level>
      <class>com.ibm.j2ca.base.WBIResourceAdapter</class>
      <method>start(BootstrapContext)</method>
      <thread>10</thread>
      <message>AFC Version : 7.0.0.4 IF02</message>
    </record>
    <record>
      <date>2012-01-18T10:11:27</date>
      <millis>1326852687687</millis>
      <sequence>2</sequence>
      <logger>com.ibm.j2ca.RAIMSTM</logger>
      <level>FINER</level>
      <class>com.ibm.j2ca.base.WBIResourceAdapter</class>
      <method>start(BootstrapContext)</method>
      <thread>10</thread>
      <message>Exiting method.</message>
    </record>
  • Simple formatter
    2012-1-18 10:22:13 com.ibm.j2ca.base.WBIResourceAdapter start(BootstrapContext)
    FINER: Entering method.
    2012-1-18 10:22:13 com.ibm.j2ca.base.WBIResourceAdapter start(BootstrapContext)
    INFO: AFC Version : 7.0.0.4 IF02
    2012-1-18 10:22:13 com.ibm.j2ca.base.WBIResourceAdapter start(BootstrapContext)
    FINER: Exiting method.
  • IMS TM resource adapter log file specified in the geronomi-ra.xml file:
    [[12/01/18 10:22:13:453 CST ][ThreadID: 10 ][SequenceNumber: 0][ClassName: 
    com.ibm.j2ca.base.WBIResourceAdapter ][MethodName: start(BootstrapContext) ]
    [Type: INFO ][Logger: com.ibm.j2ca.RAIMSTM ][Level: FINER ][Msg: Entering method. ]]
    [[12/01/18 10:22:13:453 CST ][ThreadID: 10 ][SequenceNumber: 1][ClassName: 
    com.ibm.j2ca.base.WBIResourceAdapter ][MethodName: start(BootstrapContext) ][Type: 
    INFO ][Logger: com.ibm.j2ca.RAIMSTM ][Level: INFO ][Msg: AFC Version : 7.0.0.4 IF02 ]]
    [[12/01/18 10:22:13:468 CST ][ThreadID: 10 ][SequenceNumber: 2][ClassName: 
    com.ibm.j2ca.base.WBIResourceAdapter ][MethodName: start(BootstrapContext) ][Type: 
    INFO ][Logger: com.ibm.j2ca.RAIMSTM ][Level: FINER ][Msg: Exiting method. ]]

Feedback