Question

I am attempting to view INFO- or DEBUG-level log messages for Apache Jackrabbit 2.7.X running under Tomcat 7. I've searched for awhile and found two different possibilities on how to do this:

  • Add a WEB-INF/log4j.xml file with the appropriate configuration
  • Set Java-level properties, e.g. log4j.logger.org.apache.jackrabbit

This seems like a simple task but thus far I've not been able to make either of the above work for me.

I am particularly interested in seeing some of the "internals", e.g. what data is received over the wire versus what is created in the repository, and so forth. I don't even know if this is possible but I figure logging everything is a good place to start.

Was it helpful?

Solution

About 10 minutes after posting this I found the answer, so here it is in case somebody is trying to do the same and finds this at a later date.

Although the documentation says:

Are there any notable log entries? Check the log files for any related warnings or errors. By default the Jackrabbit JCR Server writes log entries to the standard output of the servlet container. You can customize logging by editing the /WEB-INF/log4j.xml file and redeploying this web application.

This appears to be incorrect as in fact the newer Jackrabbit uses logback, and the configuration file in the standard distribution is:

 WEB-INF/classes/logback.xml

In which you can change the basic level and append to the console as such:

  <root level="DEBUG">
    <appender-ref ref="console"/>
  </root>

You can get more advanced from there, it appears. Make the change, restart the container, and you're good to go.

OTHER TIPS

On jackrabbit 2.10.1, you should put this in WEB-INF/classes/logback.xml

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
    <encoder>
      <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} %-5level %-40([%thread] %F:%L) %msg%n</pattern>
    </encoder>
  </appender>

  <root level="DEBUG">
    <appender-ref ref="console"/>
  </root>

</configuration>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top