We help IT Professionals succeed at work.

JBOSS/Log4J configuration

Medium Priority
1,997 Views
Last Modified: 2013-12-25
Hi,

Is there a way to configure JBoss or Log4J to capture the complete XML request and response data for transactions? If there is a way to match up the response to its request that would be great but if not I'd be fine  with pouring though log files to match them up manually.

Thanks,
Ed

Comment
Watch Question

CERTIFIED EXPERT

Commented:
The simplest way is to add Thread info to the log4j debug line.
There is a ConversionPattern parameter in jboss log4j xml file.
default value is normally <param name="ConversionPattern" value="%d %-5p [%c] %m%n"/>

But if you do change it to
<param name="ConversionPattern" value="%d %-5r %-5p [%c] (%t:%x) %m%n"/>

then it log4j will put also thread name and NDC for each logged line.
After that you can trace the logging per thread which is normally correspondes to one request/responce cycle

Author

Commented:
Hi,

Thanks for the quick response. I tried changing the conversionPattern parameter as you suggested but am not seeing the request and response XMLs in the log file. I am able to trace the log entries for the request and response but what I am looking to capture is a complete depiction of the XML messages themselves. Is there a log4j configuration that will dump this data to the log file for debugging puposes?

Thanks
CERTIFIED EXPERT

Commented:
what do you mean by complete xml request/response ? is it a HTTP request/response  ? WebService call ?

Author

Commented:
It is a web service call through a relatively black box client API. So, I am not entirely sure what the request or response messages look like from the client side. I know that the API builds an XML request to send to JBoss and receives an XML in response in return. So, what I am essentially trying to do is to intercept these messages at the AppServer layer.

Thanks
CERTIFIED EXPERT
Commented:
If you are using jboss4.2.x then in jboss-log4j.xml file put following lines:

 <category name="org.jboss.ws.core.MessageTrace">
    <priority value="TRACE"/>
   </category>


if jboss-4.0.x then in log4j.xml add following lines:

<category name="jbossws.SOAPMessage">
    <priority value="TRACE"/>
   </category>

Explore More ContentExplore courses, solutions, and other research materials related to this topic.