How to add JCA/Transaction TRACE level logging in JBoss EAP

Solution Verified - Updated

Environment

  • Red Hat JBoss Enterprise Application Platform (EAP)
    • 6
    • 7
    • 8

Issue

  • In order to diagnose JCA issues in EAP it is necessary to obtain TRACE level logging for org.jboss.jca, org.jboss.as.connector and com.arjuna.
  • I want to see when a transaction begins, commits or roll-backs while troubleshooting some issues
  • I am seeing "JBAS010850: No handler for operation read-operation-description"
  • Please advise how to configure logging at TRACE level for org.jboss.jca and org.jboss.as.connector
  • Is there another way to get transaction logs

Resolution

To add TRACE level logging the following commands have to be executed in jboss-cli. Note that if the log category already exists and the add syntax is used, a "Duplicate resource" error will be reported. If this occurs, use the write-attribute rather than add syntax.

Standalone mode:

            /subsystem=logging/logger=org.jboss.jca:add(level=TRACE)
            /subsystem=logging/logger=org.jboss.as.connector:add(level=TRACE)
            /subsystem=logging/logger=com.arjuna:write-attribute(name=level,value=TRACE) 

Domain Mode:

            /profile=full-ha/subsystem=logging/logger=org.jboss.jca:add(level=TRACE)
            /profile=full-ha/subsystem=logging/logger=org.jboss.as.connector:add(level=TRACE)
            /profile=full-ha/subsystem=logging/logger=com.arjuna:write-attribute(name=level,value=TRACE) 
  • Above CLI Commands will generate the following kind of configuration inside your JBoss profile (standalone*.xml/domain*.xml)
            <logger category="com.arjuna">
                <level name="TRACE"/>
            </logger>

            <logger category="org.jboss.jca">
                <level name="TRACE"/>
            </logger>
            <logger category="org.jboss.as.connector">
                <level name="TRACE"/>
            </logger>
  • The above may generate a significant volume of logging. You may restrict trace logging depending on your objectives.
    • You may wish to configure a custom logger inside the "FILE" handler in the standalone*.xml/domain.xml
    • To trace transaction begin, commit or roll-back, enable TRACE logging for the package com.arjuna.ats.jta.
    • To trace connection requests/allocations, enable TRACE logging for org.jboss.jca.core.connectionmanager or refine further to the pool.strategy package.
            <logger category="com.arjuna.ats.jta">
                <level name="TRACE"/>
            </logger>
            <!-- OR -->
            <logger category="org.jboss.jca.core.connectionmanager">
                <level name="TRACE"/>
            </logger>

Logging is a heavy operation and usually TRACE logging is not used in a production system because of the performance cost. However if you are testing your application or still need TRACE logging, you can configure it inside your application. (follow [1] for details)

Note : In standalone*.xml/domain.xml, there will already be a logger for "com.arjuna", make sure that you comment it out. If you want arjuna logging at server level and detailed transaction logging only for an application, configure it inside your application and have a separate application log. (see [1])

Note: If you already have a logger defined, such as "com.arjuna" in your JBoss profile, to change the level you will need to use write-attribute instead of add for example:

domain mode

            /profile=full-ha/subsystem=logging/logger=com.arjuna:write-attribute(name=level,value=TRACE) 

standalone mode

            /subsystem=logging/logger=com.arjuna:write-attribute(name=level,value=TRACE)

Note: It is advisable not to separate ARJUNA and JCA TRACE logging into separate log files. Also it is vital that thread information is logged as well. It is preferable that the log formater looks as close as possible to this:

<formatter name="PATTERN">
    <pattern-formatter pattern="%d{HH:mm:ss,SSS} %-5p [%c] (%t) %s%E%n"/>
</formatter>

If you have trouble seeing TRACE logs after this, try restarting JBoss. See this knowledgebase solution for details.

[1] Separating Log4J application logging from the server.log in JBoss EAP

Components
Category

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.