Rogach Rogach - 3 months ago 53
Java Question

Is there a way to silence hsqldb logging?

I have an embedded Hsqldb set up in my project. But it dumps a lot of info on the output when working, and I currently do not need that info:

Mar 29, 2012 10:18:11 PM org.hsqldb.persist.Logger logInfoEvent
INFO: Checkpoint start
Mar 29, 2012 10:18:11 PM org.hsqldb.persist.Logger logInfoEvent
INFO: checkpointClose start
Mar 29, 2012 10:18:11 PM org.hsqldb.persist.Logger logInfoEvent
INFO: checkpointClose end
Mar 29, 2012 10:18:11 PM org.hsqldb.persist.Logger logInfoEvent
INFO: Checkpoint end


Is there a way to silence that output?

Answer

Unfortunately, i don't believe so. we have the same issue in our project. i believe i checked the source at one point in time and concluded that hsqldb does not provide a way to influence this logging.

I stand corrected (as @fredt mentioned in his comment to the other answer), you can control this logging via the jdk log levels. setting the "hsqldb.db" log level to something like WARNING will suppress this output. you can do this using the logging.properties file or programmatically (after hsqldb loads) using something like Logger.getLogger("hsqldb.db").setLevel(Level.WARNING) (assuming you are using java util logging).

As noted in the comment below, hsqldb also resets the java logging configuration. If embedding it in another application, you may want to disable that functionality by setting the system property "hsqldb.reconfig_logging" to "false" (before hsqldb is loaded).