Relational database logging
Introduction
In case of issues when using Orbeon Forms with a relational database, you might want to see what's happening between Orbeon Forms and said database. We have found that P6Spy is a useful tool for troubleshooting this scenario.
Configuration
Below, you'll find a summary of the steps you can follow to install and configure P6Spy. For more options, or if you're using an application server other than Tomcat, you'll most likely want to refer to the P6Spy documentation, and specifically their installation and configuration instructions.
Download the P6Spy jar file.
Move the P6Spy jar file to Tomcat's
lib
directory, or the equivalent directory on your application server. This should be the same directory where you installed your database driver jar file.In the same directory, create a
spy.properties
as follows. On the first line replace/var/log/tomcat
by the directory where your log files are stored. If you're using a database other than MySQL, on the second line replacecom.mysql.cj.jdbc.Driver
by the corresponding JDBC driver class name for your database.Where you define the datasource for Orbeon Forms, replace the driver class name by
com.p6spy.engine.spy.P6SpyDriver
and prefix the URL byjdbc:p6spy:
. On Tomcat, this is done by editing Tomcat'sserver.xml
, and in that file, inside theContext
you have defined for Orbeon Forms, change theResource
setting the value of thedriverClassName
attribute tocom.p6spy.engine.spy.P6SpyDriver
, and prefixing the value of theurl
attribute byjdbc:p6spy:
, as in:Restart Tomcat or the application server you're using. Check that no error messages show on the console,
catalina.out
, or equivalent with your setup. If none show and Orbeon Forms starts properly, runtail -f spy.log
in a terminal window, or equivalent on your operating system, and check that as you access, say, the Form Builder summary page, SQL statement are properly being logged.