Configure traces using scripting
Use the wsadmin tool and scripting to configure traces for a configured server. Before starting this task, the wsadmin tool must be running. See the Start the wsadmin scripting client article for more information.
Overview
Perform the following steps to set the trace for a configured server:
Procedure
- Identify the server and assign it to the server variable:
Use Jacl:
set server [$AdminConfig getid /Cell:mycell/Node:mynode/Server:server1/]
- Use Jython:
server = AdminConfig.getid('/Cell:mycell/Node:mynode/Server:server1/') print serverExample output:
server1(cells/mycell/nodes/mynode/servers/server1|server.xml#Server_1)
- Identify the trace service belonging to the server and assign it to the tc variable:
Use Jacl:
set tc [$AdminConfig list TraceService $server]
- Use Jython:
tc = AdminConfig.list('TraceService', server) print tcExample output:
(cells/mycell/nodes/mynode/servers/server1|server.xml#TraceService_1)
- Set the trace string. The following example sets the trace string for a single component:
Use Jacl:
$AdminConfig modify $tc {{startupTraceSpecification com.ibm.websphere.management.*=all=enabled}}
- Use Jython:
AdminConfig.modify(tc, [['startupTraceSpecification', 'com.ibm.websphere.management.*=all=enabled']])
- The following command sets the trace string for multiple components:
Use Jacl:
$AdminConfig modify $tc {{startupTraceSpecification com.ibm.websphere.management.*=all=enabled:com.ibm.ws. management.*=all=enabled:com.ibm.ws.runtime.*=all=enabled}}
- Use Jython:
AdminConfig.modify(tc, [['startupTraceSpecification', 'com.ibm.websphere.management.*=all=enabled:com.ibm.ws. management.*=all=enabled:com.ibm.ws.runtime.*=all=enabled']])
- Save the configuration changes. See the Saving configuration changes with the wsadmin tool article for more information.
- In a network deployment environment only, synchronize the node. See the Synchronizing nodes with the wsadmin tool article for more information.
Use the AdminControl object for scripted administration
Related Reference
Commands for the AdminControl object