Search code examples
hibernatejpalog4jspring-data-jpahsqldb

org.hsqldb disable checkpoint messages


I am using HSQLDB (2.3.4) with JPA, Hibernate (5.2.6.Final) and spring-data-jpa (1.10.6.Final). Also, the application uses org.slf4j and slf4j-log4j12. I want to disable the following messages which the HSQLDB server seems to log:

17-01-26 14:07:47 INFO  open start - state modified
17-01-26 14:07:47 INFO  checkpointClose start
17-01-26 14:07:47 INFO  checkpointClose synched
17-01-26 14:07:47 INFO  checkpointClose script done
17-01-26 14:07:47 INFO  checkpointClose end

Rather, I want to set HSQLDB logging to WARN or ERROR.

I tried the following lines before creating the Spring Application Context which will start the HSQLDB server at one point:

System.setProperty("hsqldb.reconfig_logging", "false");
Logger.getLogger("org.hsqldb").setLevel(Level.WARNING);

Additionally, I added the following to my log4j.properties:

log4j.logger.org.hibernate=WARN
log4j.logger.org.springframework=WARN
log4j.logger.org.springframework.data=WARN
log4j.logger.org.hsqldb=WARN

Still, I get the INFO messages from HSQL...

Here is my dataSource part of spring.xml:

<bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
    <property name="driverClassName" value="org.hsqldb.jdbcDriver" />
    <property name="url" value="jdbc:hsqldb:file:data/chefdb;hsqldb.write_delay=false" />
    <property name="username" value="sa" />
    <property name="password" value="" />
</bean>

Any ideas on how to disable the messages?

Thanks in advance!


Solution

  • Thanks @Neil Stockton:

    I added %c in my pattern and identified the name of the logger as hsqldb.db. Messages disappear after adding:

    log4j.logger.hsqldb.db=WARN
    

    to my log4j.properties.