Search code examples
spring-data-jpaactiviti

How to Log DDL and DML in Activiti 7


I'm looking for help on how to log bootstrap DDL and runtime DML statements with Activiti Core 7.7.0 and Spring Boot 2.7.7. According to comments on this question, I simply need to enable hibernate SQL logging, which I've attempted to do in my application properties. Here's the "STDOUT" approach I've tried:

spring.datasource.url=jdbc:h2:./data/activiti-engine
spring.jpa.hibernate.ddl-auto=update
spring.jpa.properties.hibernate.format_sql=true
spring.jpa.properties.hibernate.show_sql=true

...and here's the "Java Logger" approach I've tried:

spring.datasource.url=jdbc:h2:./data/activiti-engine
spring.jpa.hibernate.ddl-auto=update
logging.level.org.hibernate.SQL=DEBUG
logging.level.org.hibernate.type.descriptor.sql.BasicBinder=TRACE

Neither approach produces SQL statements in the console.

It's clear to me that Activiti is picking up the datasource.url and ddl-auto properties, as the file-based database contains tables, and the ACT_PROCDEF_INFO table has rows for each BPMN file I've stored in src/main/resources/processes. I just don't see the SQL statements that are producing all this work.

I should point out that I've declared neither a logback nor a log4j configuration file, so I'm seeing the default logging levels printed to the console. Plenty of log output appears in the console, but no SQL.


Solution

  • Activiti does not appear to use Hibernate. mvn dependency:tree shows no hibernate dependencies for org.activiti:activiti-spring-boot-starter:jar:7.8.0, but rather a dependency on org.mybatis:mybatis:jar:3.5.10. This is confirmed in the documentation for the previous major version of Activiti (6.0.0).

    Later in that documentation, there's mention of using JPA with org.activiti:activiti-spring-boot-starter-jpa, but it doesn't appear that artifact has moved forward into 7.x. Maven central's latest versions are either 6.0.0 or 5.23.0, and the Alfresco Nexus does not have any versions of this artifact.