Relational database logging
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.
- 2.Move the P6Spy jar file to Tomcat's
libdirectory, or the equivalent directory on your application server. This should be the same directory where you installed your database driver jar file.
- 3.In the same directory, create a
spy.propertiesas follows. On the first line replace
/var/log/tomcatby the directory where your log files are stored. If you're using a database other than MySQL, on the second line replace
com.mysql.cj.jdbc.Driverby the corresponding JDBC driver class name for your database.logfile=/var/log/tomcat/spy.logdriverlist=com.mysql.cj.jdbc.Driverdateformat=MM-dd-yy HH:mm:ss:SSlogMessageFormat=com.p6spy.engine.spy.appender.CustomLineFormatcustomLogMessageFormat=%(currentTime)|%(executionTime)|%(category)|connection%(connectionId)\n%(sql)
- 4.Where you define the datasource for Orbeon Forms, replace the driver class name by
com.p6spy.engine.spy.P6SpyDriverand prefix the URL by
jdbc:p6spy:. On Tomcat, this is done by editing Tomcat's
server.xml, and in that file, inside the
Contextyou have defined for Orbeon Forms, change the
Resourcesetting the value of the
com.p6spy.engine.spy.P6SpyDriver, and prefixing the value of the
jdbc:p6spy:, as in:<Resourcename="jdbc/mysql"driverClassName="com.p6spy.engine.spy.P6SpyDriver"auth="Container"type="javax.sql.DataSource"initialSize="3"maxActive="10"maxIdle="10"maxWait="30000"poolPreparedStatements="true"testOnBorrow="true"validationQuery="select 1"username="orbeon"password=""url="jdbc:p6spy:mysql://localhost:3306/orbeon?useUnicode=true&characterEncoding=UTF8"/>`
- 5.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, run
tail -f spy.login 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.