Enabling trace on client and stand-alone applications

When stand-alone client applications (such as Java™ applications, which access enterprise beans that are hosted in WebSphere® Application Server) have problems interacting with WebSphere Application Server, it might be useful to enable tracing for the application. Enabling trace for client programs causes the WebSphere Application Server classes used by those applications, such as naming-service client classes, to generate trace information.

About this task

A common troubleshooting technique is to enable tracing on both the application server and client applications, and match records according to timestamp to try to understand where a problem is occurring.

[z/OS]You can also configure tracing from the MVS™ console using the modify command.

Two methods exist for enabling trace.
  • Using java –D system arguments (recommended)
  • Using the TraceSettings.properties file

Procedure

  • Using java –D system arguments
    1. Add the following for WebSphere component trace:
      -Dcom.ibm.ejs.ras.lite.traceSpecification=traceSpecString
      -Dcom.ibm.ejs.ras.lite.traceFileName=logName
      -Djava.util.logging.manager=com.ibm.ws.bootstrap.WsLogManager
      -Djava.util.logging.configureByServer=true
    2. Add the following for ORB trace:
      -Dcom.ibm.CORBA.Debug=true
      -Dcom.ibm.CORBA.CommTrace=true
      -Dcom.ibm.CORBA.Debug.Output=logName
      Note:
      • The value of logName must be the same for both properties com.ibm.CORBA.Debug.Output and com.ibm.ejs.ras.lite.traceFileName.
      • TraceSpecString is a colon-separated list of trace specs (for example, Naming=all:Runtime=all)
      Example
      java -classpath com.ibm.ws.ejb.thinclient_9.0.jar;myClient.jar
      -Dcom.ibm.ejs.ras.lite.traceSpecification=WLM*=all:Naming=all
      -Dcom.ibm.ejs.ras.lite.traceFileName=myClient.log
      -Djava.util.logging.manager=com.ibm.ws.bootstrap.WsLogManager
      -Djava.util.logging.configureByServer=true
      -Dcom.ibm.CORBA.Debug=true
      -Dcom.ibm.CORBA.CommTrace=true
      -Dcom.ibm.CORBA.Debug.Output=myClient.log
      -Djava.naming.provider.url=iiop://myserver.com:2809 myClient
  • Using the TraceSettings.properties file
    1. Create a TraceSettings.properties file into which trace specifications are entered.

      [AIX Solaris HP-UX Linux Windows][z/OS]The file created must be a properties file placed in the class path of the application client or stand-alone process. Create a trace properties file by copying the %install_root\properties\TraceSettings.properties file to the same directory as your client application Java archive (JAR) file.

      [IBM i]The file created must be a properties file placed in the class path of the application client or stand-alone process. Create a trace properties file by copying the app_server_root/properties/TraceSettings.properties file to the same directory as your client application Java archive (JAR) file.

    2. [AIX Solaris HP-UX Linux Windows][IBM i] Specify the output location for the generated trace.
      Within the TraceSettings.properties file, use the traceFileName property to designate the trace output location. You must specify this property to generate visible output. Specify one of two options:
      traceFileName=filename
      where filename is the fully qualified name of an output file. For example, traceFileName=c:\\MyTraceFile.log
      traceFileName=stdout
      When specified, output is written to System.out
    3. Specify the trace spec string(s).
      Within the TraceSettings.properties file, specify a trace spec string similar to that available on the server (for example, WLM*=all). To trace multiple components, enter each individual trace string, one per line without any colons (:). For example,
      WLM*=all
      Naming=all
      Note: ORB trace cannot be enabled through the TraceSettings.properties file. Instead add the following system properties to the client startup script or command line invocation:
      -Dcom.ibm.CORBA.Debug=true
      -Dcom.ibm.CORBA.CommTrace=true
      -Dcom.ibm.CORBA.Debug.Output=filename

      If enabling both ORB and WebSphere component trace (for example, Naming=all), ensure the filename specified in com.ibm.CORBA.Debug.Output is the same as that specified by the traceFileName property within the TraceSettings.properties file.

    4. Specify the TraceSettings.properties file and logManager properties on the command line.
      Add the following system properties to the startup script or command of the client application.
      -DtraceSettingsFile=filename
      -Djava.util.logging.manager=com.ibm.ws.bootstrap.WsLogManager 
      -Djava.util.logging.configureByServer=true

      filename is the TraceSettings.properties file created in step #1.

      The java.util.logging.manager and java.util.logging.configureByServer system properties configure Java logging to use a WebSphere Application Server-specific LogManager class and to use the configuration from the file specified by the traceSettingsFile property. The default Java Logging properties file, located in the Java SE Runtime Environment, is not be applied.

      Example
      java -DtraceSettingsFile=MyTraceSettings.properties 
      -Djava.util.logging.manager=com.ibm.ws.bootstrap.WsLogManager 
      -Djava.util.logging.configureByServer=true
      -Dcom.ibm.CORBA.Debug=true
      -Dcom.ibm.CORBA.CommTrace=true
      -Dcom.ibm.CORBA.Debug.Output=c:\\MyTraceFile.log
      com.ibm.samples.MyClientProgram