Tracing operations using wsadmin.sh

 

Overview

The default properties file, wsadmin.properties, specifies that logging information goes to...

$WAS_HOME/logs/wsadmin.traceout

If com.ibm.ws.scripting.traceString is set in wsadmin.properties, diagnostic trace information also logs to this file.

If com.ibm.ws.scripting.traceFile is not set in wsadmin.properties, information goes to the console.

You can turn on traces of the WAS code running inside the scripting process by either specifying the com.ibm.ws.scripting.traceString property, or by using the AdminControl object trace method.

 

Enable trace

Using Jacl

$AdminControl trace com.ibm.*=all=enabled

Using Jython

AdminControl.trace('com.ibm.*=all=enabled')

 

Disable trace

Using Jacl

$AdminControl trace com.ibm.*=all=disabled

Using Jython

AdminControl.trace('com.ibm.*=all=disabled')

 

Set persistent trace

The trace command changes the trace settings for the current session. You can change this setting persistently by editting the wsadmin.properties file. The property com.ibm.ws.scripting.traceString is read by the launcher during initialization. If it has a value, the value is used to set the trace.

A related property, com.ibm.ws.scripting.traceFile, designates a file to receive all trace and logging information. The wsadmin.properties file contains a value for this property. Run wsadmin.sh with a value set for this property. It is possible to run without this property set, where all logging and tracing goes to the administrative console.

 

Turn on Trace Examples

 

Using Jacl

### Identify the object name for the TraceService MBean running in the process...

$AdminControl completeObjectName type=Server,name=server,*


### Obtain the name of the object and set it to a variable...

set ts [$AdminControl completeObjectName type=TraceService,process=server,*]


### Turn on traces for the server...

$AdminControl setAttribute $ts traceSpecification com.ibm.*=all=enabled

 

Using Jython

### Identify the object name for the TraceService MBean running in the process...

AdminControl.completeObjectName('type=Server,name=server,*')


### Obtain the name of the object and set it to a variable...

ts = AdminControl.completeObjectName('type=TraceService,process=server,*')


### Turn on traces for the server...

AdminControl.setAttribute(ts, 'traceSpecification', 'com.ibm.*=all=enabled')

 


Configure a trace using wsadmin

 

Using Jacl:

### Identify the server and assign it to the server variable...

set server [$AdminConfig getid /Cell:cell/Node:node/Server:server/]


### Identify the trace service belonging to the server 
set tc [$AdminConfig list TraceService $server]


### Set the trace string.

$AdminConfig modify $tc {{startupTraceSpecification com.ibm.websphere.management.*=all=enabled}}


### Set the trace string for multiple components...

$AdminConfig modify $tc {{startupTraceSpecification com.ibm.websphere.management.*=all=enabled:com.ibm.ws.management.*=all=enabled:com.ibm.ws.runtime.*=all=enabled}}


$AdminConfig save

 

Using Jython

### Identify the server and assign it to the server variable...

server = AdminConfig.getid('/Cell:cell/Node:node/Server:server/')
print server


### Identify the trace service belonging to the server 
tc = AdminConfig.list('TraceService', server)
print tc


### Set the trace string.
AdminConfig.modify(tc, [['startupTraceSpecification',  'com.ibm.websphere.management.*=all=enabled']])



### Set the trace string for multiple components...
AdminConfig.modify(tc, [['startupTraceSpecification',  'com.ibm.websphere.management.*=all=enabled:com.ibm.ws.management.*=all=enabled:com.ibm.ws.runtime.*=all=enabled']])


AdminConfig.save()