WSAD 5.1 with WAS 5.0 and Struts 1.1
logging the prepared statement parameters to the output console for debugging purposes.
1. Goto C:\Program Files\IBM\WebSphere Studio\Application Developer\v5.1\runtimes\base_v5\lib
2. Unzip the commons-logging-api.jar
3. Add a properties file called simplelog.properties to the commons-logging-api.jar
with the following property:
Code:
org.apache.commons.logging.simplelog.defaultlog=debug
4. Zip the jar backup and replace the existing jar
1. Goto C:\Program Files\IBM\WebSphere Studio\Application Developer\v5.1\runtimes\base_v5\lib
2. Unzip the ws-commons-logging.jar
3. Modify the commons-logging.properties file. It should read as follows:
Code:
#org.apache.commons.logging.LogFactory=com.ibm.ws.commons.logging.TrLogFactory
org.apache.commons.logging.LogFactory=org.apache.commons.logging.impl.LogFactoryImpl
4. Zip the jar backup and replace the existing jar
Re-start your WAS server in your WSAD test environment. Debug statements should now be available on the console.
This solution is clearly not optimal as it modifies run-time components of WAS. This can be tolerated if this is in your development environment only. If anyone can figure out how to do this with property files inside the deployable ear file this would be the preferred way to get the hibernate debug logging.
The problem is that WAS uses commons-logging upon WAS startup and sets the Logger to be used. When hibernate calls
Code:
LogFactory.getLog(xxx.class);
The default logger that was initialized upon WAS server startup is used. This logger does not have default log level of less than INFO. This needs to be changed so that the default log level is at least DEBUG in order to see the values of the hibernate parameters in the prepared statements.
There also is probably some programmatic methods to set the Logger to be Log4J with a default log level of DEBUG after WAS startup. Again if anyone figures this out please post your solution.