Slow SQL Logging in Payara Micro

Payara Micro supports slow logging of SQL queries which brings powerful operational diagnostics to your microservices platform.

Enabling Slow SQL Logging

To enable it on applications deployed on Payara Micro, you can use the annotation or deployment descriptor methods described below.

Application Deployment

In Java EE 7+ applications, a JDBC data source can be deployed by adding the @DataSourceDefinition annotation to a managed component (like and @Stateless EJB bean for example). The Slow Query Log Threshold time can be configured using this annotation, like in the following example:

    name = "java:app/MyApp/MyDS",
    className = "org.h2.jdbcx.JdbcDataSource",
    url = "jdbc:h2:mem:test",
    properties = {"fish.payara.slow-query-threshold-in-seconds=5"})

The Data source definition can also be added to a deployment descriptor of an application, for example in the web.xml standard deployment descriptor:

    <!-- Example of how to use a Payara specific custom connection pool setting -->