Monday, November 30, 2015

Activiti: how to enable MyBatis SQL logging

We use SLF4J as the logging API, and Logback as the implementation for testing. Fortunately MyBatis supports multiple logging frameworks, SLF4J included, based on runtime auto-detection. See http://mybatis.org/mybatis-3/logging.html for more details.

Enabling SQL logging turned out the be quite easy, but it took a while to figure out, because the current top search results are out of date: they work with older versions of MyBatis (or iBatis).

To cut to the chase, the solution is simply to set the logger "org.activiti.engine.impl.persistence.entity" to level DEBUG:
<logger name="org.activiti.engine.impl.persistence.entity" level="DEBUG" />
In our case we are only interested in SQL statements for the ExecutionEntity, so our configuration can be more specific:
<logger name="org.activiti.engine.impl.persistence.entity.ExecutionEntity" level="DEBUG" />
For process/task variables:
<logger name="org.activiti.engine.impl.persistence.entity.VariableInstanceEntity" level="DEBUG" />