Debugging iBeans
The following describes various methods for getting more information out of iBeans if something is not working the way it should.
Logging
Often the simplest approach is to check the logs to see if a problem has occurred. iBeans log file is located in -
$CATALINA_HOME/logs/mule-ibeans.log
The configuration for this log file can be found in -
$CATALINA_HOME/mule-ibeans/conf/log4j.properties
You can add your application specific logging in this file if you want to.
| I can't see the log file Because Log4J searches your classpath for its configuration file the configuration file you want to use is not always the one that gets used. To find out what configuration Log4j is using start up Tomcat using - export JAVA_OPTS="-Dlog4j.debug=true" $CATALINA_HOME/bin/startup.sh This will write additional debug information the the $CATALINA_HOME/logs/catalina.out file. |
What gets Sent and Received
You'll will almost always be making network calls over HTTP when using iBean objects. When you write your own you will want to see what gets sent and received over the wire. There are a fe ways of doing this.
HTTP tracing
You can turn on HTTP tracing so that all data get written to the logs, just add the following line to the $CATALINA_HOME/mule-ibeans/conf/log4j.properties file.
log4j.logger.org.apache.commons.httpclient=TRACE
IBeans message logging
iBeans will also log messages as they going in and out. The log message provides insights into the state of the iBeans message before it get sent. To turn on this logging add the following $CATALINA_HOME/mule-ibeans/conf/log4j.properties file.
log4j.logger.org.mule.ibeans=TRACE
Using a Proxy like TCP Mon
iBeans allows you to set a VM parameter that tells all HTTP calls to get routed via proxy server. This allows tools such as TCP Mon to inspect the request and response data. To enable proxying simply add the VM parameter -Dibeans.debug.proxy.host and -Dibeans.debug.proxy.port. Note that only the proxy.port needs to be set to enable proxying, the proxy.host will default to 127.0.0.1. For example -
-Dibeans.debug.proxy.host=192.168.0.3 -Dibeans.debug.proxy.port=8082
Log Response Interceptor
This interceptor will log all response data it receives to individual files. While this is useful as an audit of what came back, it is mostly used for creating data sets for mock test-cases. To enable this interceptor set the -Dibeans.log.responses with a directory path where the responses will get written.
-Dibeans.log.responses=/projects/ibeans/test/data
IDE Debugging
iBeans has an Eclipse plugin that makes it very easy to debug an iBean application. This screen cast provides a in depth guide to Getting Started with Eclipse.
iBeans does not have a plugin for IntelliJ, but you can still use iBeans with IntelliJ, the steps required are listed in the section Using IntelliJ with iBeans.
Add Comment