blob: 342917d36e03996448ec14638b899c84872b92c1 [file] [log] [blame]
Title: Configuring Logging
<P>Cayenne logging is based on Jakarta Apache <A href="http://jakarta.apache.org/commons/logging/" class="external-link" rel="nofollow">commons-logging package</A>. Commons-logging allows users to choose their own logging provider, such as Log4J or <TT>java.util.logging</TT>. Below is an example of a <A href="http://logging.apache.org/log4j/docs/" class="external-link" rel="nofollow">Log4J-based</A> configuration of the most important Cayenne logger that turns on and off SQL tracing:</P>
<DIV class="preformatted panel" style="border-width: 1px;"><DIV class="preformattedContent panelContent">
<PRE># Turn SQL tracing on
log4j.logger.org.apache.cayenne.access.QueryLogger = INFO
# Turn SQL tracing off, e.g. to increase performance
log4j.logger.org.apache.cayenne.access.QueryLogger = WARN
</PRE>
</DIV></DIV>
<P>Another example shows how to trace Cayenne configuration loading. Cayenne XML files may contain errors, or maybe missing or inaccessible by the application; there maybe lots of other reasons why Cayenne fails to startup, from missing JDBC drivers to misspelled database URLs. This logger helps you to debug it:</P>
<DIV class="preformatted panel" style="border-width: 1px;"><DIV class="preformattedContent panelContent">
<PRE>log4j.logger.org.apache.cayenne.conf = DEBUG
log4j.logger.org.apache.cayenne.util = DEBUG
</PRE>
</DIV></DIV>