Tracing IMS Universal drivers applications

To obtain data for diagnosing problems with the IMS Universal drivers, you can collect trace data.

Attention: Collecting tracing data must be enabled only for diagnosing problems with the IMS Universal drivers. Enabling traces in a production environment on a regular basis is not recommended.

Use one of the following procedures to enable tracing.

Turning on automatic tracing in JRE logging.properties file

The recommended method is to enable the trace by setting the trace level for the IMS Universal drivers loggers in the logging.properties file of your Java™ Runtime Environment (JRE). Using this method, the application does not need to be recompiled. The file is located on the install path of your JRE, under \jre\lib\logging.properties. The recommended trace level is FINEST.

To set the trace for all IMS Universal drivers loggers, add the following line to the logging.properties file:

com.ibm.ims.db.opendb = FINEST

To send the trace output to a file, make the following changes to your logging.properties file:

  1. Make sure that the file includes the following line and no other handlers= lines, unless they are commented out. A pound sign (#) at the beginning of a line indicates that the line is a comment.
    handlers = java.util.logging.FileHandler, java.util.logging.ConsoleHandler
    
  2. Add the following lines:
    java.util.logging.FileHandler.level = FINEST
    java.util.logging.FileHandler.pattern = c:/UniversalDriverTrace.txt
    java.util.logging.FileHandler.formatter = java.util.logging.SimpleFormatter

Configuring Java EE tracing

Tracing can be turned on from your Java EE application server. In WebSphere® Application Server, this is configured through the administrative console. The IMS Universal Database resource adapter must be deployed on WebSphere Application Server before tracing can be configured.

In WebSphere Application Server Liberty, tracing is configured through the server.xml configuration file.

  • To get the most detailed trace from the IMS Universal Database resource adapter, follow these steps:
    1. Start the WebSphere Application Server administration console.
    2. Select Troubleshooting.
    3. Select Logs and Trace.
    4. Select your application server from the table.
    5. Under General Properties, select Diagnostic Trace.
    6. Under Additional Properties, select Change Log Detail Levels.
    7. Select the Runtime tab.
      • Make sure that the Save runtime changes to configuration as well check box is turned ON.
      • Under the Change Log Details Levels section, select the component com.ibm.ims.db.opendb. This brings up the Message and Trace levels menu.
      • Select the message level FINEST.
      • Click Apply.
    8. To save these changes for the next time the application server is started, click the Save link at the top of the page. WebSphere Application Server does not need to be restarted.
  • To get the most detailed trace from the WebSphere Application Server Liberty, follow these steps:
    1. In the server.xml configuration file, add a <logging> element that contains a traceSpecification attribute and the String argument com.ibm.ims.db.opendb.* :
      <logging traceSpecification="*=info:com.ibm.ims.db.opendb.*=finest"/>
    2. The default directory for the trace.log file can be found in the logsk/ directory of the server instance. No restart is required for WebSphere Application Server Liberty.

Programmatically enabling tracing

You can also programmatically turn on tracing in your IMS Universal drivers application. This requires the application to be recompiled.

  1. Import the java.util.logging package in your application and create a logger by calling the Logger.getLogger method with the String argument com.ibm.ims.db.opendb.
  2. In your application, you can set the level of tracing for the logger by using the Logger.setLevel method. The recommended trace level is Level.FINEST.

The following sample code shows how programmatic trace is enabled for any IMS Universal drivers application.

private static final Logger universalLogger 
   = Logger.getLogger("com.ibm.ims.db.opendb");
universalLogger.setLevel(Level.FINEST);
FileHandler fh 
   = new FileHandler("C:/UniversalTrace.txt");
fh.setFormatter(new SimpleFormatter());
fh.setLevel(Level.FINEST);
universalLogger.addHandler(fh);