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.
Two methods exist for enabling trace.
- Using java –D system arguments (recommended)
- Using the TraceSettings.properties file
Procedure
-
Using java –D system arguments
-
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
-
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)
Examplejava -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
-
Create a TraceSettings.properties file into which trace specifications are
entered.
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.
-
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
-
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.
-
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.
Examplejava -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