Enabling and disabling WebSphere traces on steroids

Created:
Author: Christoph Stoettner
Read in about 3 min · 575 words

Person stepping on blue chairs

Photo by Lindsay Henwood | Unsplash

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

Open WebSphere Application servers overview, click the server name where you want to enable traces

Click on Diagnostic trace service

Click on Runtime

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.

Open Change log detail level

Add the trace string to text box and click OK or Apply

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:

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.

Resources

Author
Add a comment
Error
There was an error sending your comment, please try again.
Thank you!
Your comment has been submitted and will be published once it has been approved.

Your email address will not be published. Required fields are marked with *

Suggested Reading
Card image cap
HCL Support published a collection of links to MustGather informations for Connections and addons. That’s the perfect starting point to start troubleshooting and collecting logs for your support cases. Collecting Data: Repository of MustGather for Connections
Created: Read in about 1 min
Aaron Burden: Fountain pen and a notebook
Because i had several issues with automated renewed ssl and ltpa keys on my websphere servers, i found this article on the blog of Mitch Cohen : http://www.curiousmitch.com/2009/06/disabling-automatic-ltpa-key-generation-in-was-or-how-to-stopsso-between-was-and-domino-from-breaking/ Perhaps this is interesting for more people.
Created:
Last Update:
Read in about 1 min
Aaron Burden: Fountain pen and a notebook

This week I installed IBM Connections 5.5CR1 on a Windows Server. I used WebSphere Application Server 8.5.5.9 and everything ran pretty smooth, but the Connections install itself ended in an error after all applications were successfully installed.

Created:
Last Update:
Read in about 1 min