Example script for configuring trace levels
This script package sets a trace specification level ,
com.ibm.ws.ibm.*=info
for example, on all servers in a cell. It can be included on
either a stand alone virtual system pattern part or a deployment manager virtual system pattern
part. Users can specify the trace specification during deployment.
Script variables
The following parameter
is included in this script package.
- TRACE_SPEC:
- Specifies the trace specification for the cell. This parameter is required.
cbscript.json example
[
{
"name": "Configure Trace Specification",
"version": "1.0.0",
"description": "This script package configures trace specification on all servers in a cell",
"command": "${WAS_PROFILE_ROOT}/bin/wsadmin.sh",
"log": "${WAS_PROFILE_ROOT}/logs/wsadmin.traceout",
"location": "/opt/tmp/configtrace",
"timeout": "0",
"commandargs": "-lang jython -f /opt/tmp/configtrace/configure_trace.jy $TRACE_SPEC",
"type": "APPLICATION",
"keys":
[
{
"scriptkey": "TRACE_SPEC",
"scriptvalue": ""
}
]
}
]
Example script
Note: This example script is
designed for Version 7.0.0.x virtual system patterns only.
from java.lang import String
traceSpec = sys.argv[0]
nodes = AdminNodeManagement.listNodes()
for node in nodes:
nodeStr = String(node)
nodeStr = String(nodeStr.substring(0, nodeStr.indexOf('('))).trim()
appServers = AdminServerManagement.listServers('APPLICATION_SERVER', nodeStr)
for appServer in appServers:
appServerStr = String(appServer)
appServerStr = String(appServerStr.substring(0, appServerStr.indexOf('('))).trim()
AdminTask.setTraceSpecification('[-serverName ' + appServerStr +' -nodeName ' + nodeStr + ' -traceSpecification ' + traceSpec + ' -persist true]')
AdminConfig.save()