WAS v8.5 > Script the application serving environment (wsadmin) > Troubleshooting with scriptingSet up profile scripts to make tracing easier using wsadmin.sh
We can use scripting and wsadmin to set up profile scripts to facilitate tracing.
Before starting this task, wsadmin must be running. See Start the wsadmin scripting client using wsadmin.sh for more information.
Set up a profile script to make tracing easier. The following profile script example turns tracing on and off for server1:
Jacl:
proc ton {} { global AdminControl set ts [$AdminControl queryNames type=TraceService,node=mynode,process=server1,*] $AdminControl setAttribute $ts traceSpecification com.ibm.=all=enabled} proc toff {} { global AdminControl set ts [$AdminControl queryNames type=TraceService,node=mynode,process=server1,*] $AdminControl setAttribute $ts traceSpecification com.ibm.*=all=disabled} proc dt {} { global AdminControl set jvm [$AdminControl queryNames type=JVM,node=mynode,process=server1,*] $AdminControl invoke $jvm dumpThreads }Jython:
def ton(): global lineSeparator ts = AdminControl.queryNames('type=TraceService,node=mynode,process=server1,*') AdminControl.setAttribute(ts, 'traceSpecification', 'com.ibm.=all=enabled') def toff(): global lineSeparator ts = AdminControl.queryNames('type=TraceService,node=mynode,process=server1,*') AdminControl.setAttribute(ts, 'traceSpecification', 'com.ibm.*=all=disabled') def dt(): global lineSeparator jvm = AdminControl.queryNames('type=JVM,node=mynode,process=server1,*') AdminControl.invoke(jvm, 'dumpThreads')
The dumpThreads command creates other types of dump files depending on the -Xdumps settings. Dump output varies depending on the platform and might include system core files, heap, and snap dumps.
If you start wsadmin with this profile script, we can use the ton command to turn on tracing in the server, the toff command to turn off tracing, and the dt command to dump the Java threads. For more information about running scripting commands in a profile script, see Start the wsadmin scripting client using wsadmin.sh.
Related
Use the wsadmin scripting AdminControl object for scripted administration
Reference:
Commands for the AdminControl object using wsadmin.sh