During troubleshooting of WebSphere Application Server it is necessary to enable traces and see more detailed log messages.
Enabling these traces is very annoying, because you need to follow long click paths within the Integrated Solution Console (ISC).
Enable traces within ISC
Most of the time it is sufficient to enable traces for the runtime of the application server. So no need to restart the application server, after restart the trace settings are set back to default.
So after 6 or 7 clicks you’re ready to …
do the same on the next application server, if you have multiple WebSphere nodes for this environment.
After reproducing the error, you can go the same way and set the text box back to *=info
or restart the application server to remove the trace settings. Traces produce a lot of IO and so the performance can be very low during activated trace settings. Disable them as soon as possible.
Enable and disable traces with wsadmin.sh
I found a script to print the cluster members of a WebSphere Cluster and extended it with the documented steps to enable tracing on running WebSphere application servers .
Following script enables traces when you start it with two parameters (Cluster name and the trace string) and disables all traces when it is started with one parameter (Cluster name).
'''
Enable / disable trace settings for all cluster members
Cluster name is passed as first parameter to the script
Tracestring is passed as second parameter
if Tracestring is empty -> disable trace
author: Christoph Stoettner
mail: christoph.stoettner@stoeps.de
license: Apache 2.0
'''
import sys
if len(sys.argv) == 0:
print('''
\tScript needs at least one parameter: Clustername
\n\tWhen a second parameter is used, it is interpreted as trace string
\n\n\tExample:
\twsadmin.sh -lang jython -f clusterTrace.py InfraCluster "*=info:com.ibm.lconn.news.*=all:com.ibm.lconn.hpnews.*=all"
''')
sys.exit()
elif len(sys.argv) == 1:
type = 'disabled'
cluster_name=sys.argv[0]
else:
cluster_name=sys.argv[0]
traces=sys.argv[1]
type = 'enabled'
if type == 'enabled':
trace_string=''
for trace in traces.split(':'):
if trace_string=='':
trace_string=trace + '=' + type
else:
trace_string=trace_string + ':' + trace + '=' + type
else:
trace_string='*=info=enabled'
cluster_id = AdminConfig.getid("/ServerCluster:"+cluster_name+"/")
if not cluster_id:
raise "Cluster %s does not exist!" % cluster_name
member_ids = AdminConfig.showAttribute(cluster_id, "members")
member_ids = member_ids[1:-1]
for member_id in member_ids.split():
member_name=AdminConfig.showAttribute(member_id, "memberName")
node_name=AdminConfig.showAttribute(member_id, "nodeName")
# Get TraceServer ID
ts=AdminControl.completeObjectName('type=TraceService,process='+member_name+',*')
# Set trace settings
try:
AdminControl.setAttribute(ts, 'traceSpecification', trace_string)
print("Successfully " + type + " trace on " + node_name + '/' + member_name)
except:
print("Error changing trace on " + node_name + '/' + member_name)
So to enable the trace string *=info:com.ibm.lconn.news.*=all:com.ibm.lconn.core.services.*=all:com.ibm.lconn.hpnews.*=all
on the InfraCluster
, run the following command:
bin
folder within your Deployment Manager profile.cd /opt/IBM/WebSphere/AppServer/profiles/Dmgr01/bin
./wsadmin.sh -lang jython -f clusterTrace.py InfraCluster "*=info:com.ibm.lconn.news.*=all:com.ibm.lconn.core.services.*=all:com.ibm.lconn.hpnews.*=all"
Now do whatever needs to be done to reproduce your issue.
To disable the trace on the InfraCluster
, run:
cd /opt/IBM/WebSphere/AppServer/profiles/Dmgr01/bin
./wsadmin.sh -lang jython -f clusterTrace.py InfraCluster
Even when the performance of the frontend lags during the activated trace, you can disable it with wsadmin
nearly immediately. This saves you time, disk space and several meters of mouse movement.