Kodo JDO uses the Apache Jakarta Commons Logging thin library for issuing log messages. The Commons Logging libraries act as a wrapper around a number of popular logging APIs, including the Jakarta Log4J project, and the native java.util.logging package in JDK 1.4. If neither of these libraries are available, then logging will fall back to using a very simple console logging. The remainder of this section presumes that Log4J will be used for logging. For details on customization of the Commons project, or on details on any of the underlying logging packages, please see the appropriate project page.
Logging is done over a number of logging channels, each of which has a logging level, which controls the verbosity of log messages that are sent to the channel. Following is an overview of the logging channels that Kodo will use, with a summary of the different levels to which log messages will be sent.
com.solarmetric.kodo.MetaData: Information about the parsing of JDO metadata will be sent to the trace level of this channel. Warnings about potential problems with metadata will be sent to the warn channel.
com.solarmetric.kodo.Enhance: Messages issued by the JDO enhancer will be sent to this logger, on a veriety of channels.
com.solarmetric.kodo.Runtime: General Kodo runtime messages will be sent to this channel.
com.solarmetric.kodo.Configuration: Information about Kodo Configuration will be sent to this channel.
com.solarmetric.kodo.impl.jdbc.JDBC: JDBC connection information will be sent to this channel.
com.solarmetric.kodo.impl.jdbc.SQL: This is the most common logging channel to use. Detailed information about the execution of SQL statements and connections will be sent to the info channel. It is useful to enable this channel if you are curious about the exact SQL that Kodo issues to the data store. By default, the SQL being executed is only listed once, when a PreparedStatement is first created. When the statement is executed, a hashcode will be printed out. This number can be used to cross-reference the actual SQL string being executed. If this channel is set to TRACE, then the actual SQL executed will be printed out every time the statement is reused.
![]() | Note |
---|---|
Verbose SQL information is sent to this channel only when using Kodo's own pooling DataSource implementation. When using a custom DataSource, consult the documentation for that DataSource for details on how to enable logging messages. |
com.solarmetric.kodo.impl.jdbc.Schema: Details about the operation of the SchemaTool will be sent to this logging channel.
Example 2.3. Example log4j.properties file for moderately verbose logging
log4j.rootCategory=WARN, console log4j.category.com.solarmetric.kodo.impl.jdbc.SQL=WARN, console log4j.category.com.solarmetric.kodo.impl.jdbc.JDBC=WARN, console log4j.category.com.solarmetric.kodo.impl.jdbc.Schema=INFO, console log4j.category.com.solarmetric.kodo.Performance=INFO, console log4j.category.com.solarmetric.kodo.MetaData=WARN, console log4j.category.com.solarmetric.kodo.Enhance=WARN, console log4j.category.com.solarmetric.kodo.Query=WARN, console log4j.category.com.solarmetric.kodo.Runtime=INFO, console log4j.appender.console=org.apache.log4j.ConsoleAppender
Example 2.4. Example log4j.properties file for disabled logging
log4j.rootCategory=ERROR, console log4j.category.com.solarmetric.kodo.impl.jdbc.SQL=ERROR, console log4j.category.com.solarmetric.kodo.impl.jdbc.JDBC=ERROR, console log4j.category.com.solarmetric.kodo.impl.jdbc.Schema=ERROR, console log4j.category.com.solarmetric.kodo.Performance=ERROR, console log4j.category.com.solarmetric.kodo.MetaData=ERROR, console log4j.category.com.solarmetric.kodo.Enhance=ERROR, console log4j.category.com.solarmetric.kodo.Query=ERROR, console log4j.category.com.solarmetric.kodo.Runtime=ERROR, console log4j.appender.console=org.apache.log4j.ConsoleAppender
Example 2.5. Example log4j.properties file for debugging logging
log4j.rootCategory=TRACE, console log4j.category.com.solarmetric.kodo.impl.jdbc.SQL=TRACE, console log4j.category.com.solarmetric.kodo.impl.jdbc.JDBC=TRACE, console log4j.category.com.solarmetric.kodo.impl.jdbc.Schema=TRACE, console log4j.category.com.solarmetric.kodo.Performance=TRACE, console log4j.category.com.solarmetric.kodo.MetaData=TRACE, console log4j.category.com.solarmetric.kodo.Enhance=TRACE, console log4j.category.com.solarmetric.kodo.Query=TRACE, console log4j.category.com.solarmetric.kodo.Runtime=TRACE, console log4j.appender.console=org.apache.log4j.ConsoleAppender