Logging
Explanation
XWiki writes its log records through SLF4J, backed by Logback by default, and the bundled Logging Application lists every registered logger in the wiki administration. That application is the user interface of the Logging Module, the component that lists those loggers and applies the levels you set.
The configuration that decides what is written, and where, is the logback.xml file of the deployed web application.
How XWiki Collects Logs
Every library on XWiki's runtime classpath ends up in that same output, whichever logging framework it was written against: XWiki ships an SLF4J bridge for Apache Commons Logging, for Log4j 1.x and for Log4j 2, so none of them needs a configuration file of its own. XWiki 18.10.0+ The same holds for java.util.logging, used by Lucene behind Solr. Unless a bridge is already installed, XWiki installs one at start-up in place of the handlers of the java.util.logging root logger, so that records are not printed twice, and puts those handlers back when it stops. The LevelChangePropagator declared in the Logback configuration applies the levels you configure there to the java.util.logging loggers, so they stop producing records for levels you disabled.
Where the Logs Go
The shipped Logback configuration declares a single console appender, so XWiki itself writes nowhere else. Log File Locations gives the file each installation method captures that console into.
Long operations run as jobs, and a job keeps a log of its own beside the main one.
Changing What Is Logged
There are two ways to change a logger's level, and they differ in one respect that matters more than the rest: only a change made in the Logback configuration file survives a restart.
- Configure Log Levels edits logback.xml, and takes effect at the next restart.
- Change Log Levels at Runtime uses the Logging Application, and takes effect at once, which is what you want while reproducing a problem.
A logger is named after a Java package or class, and a level set on a package applies to everything below it: org.xwiki and com.xwiki cover XWiki's own components, com.xpn.xwiki its older code base, and org.hibernate the database layer.
Going Further
- Analyze Logs with Lilith streams the records to a desktop viewer built for large volumes of log events.
- Replace Logback with Another SLF4J Provider swaps the backend for a different one.
- Monitor Component Execution Times turns on the per-request timings XWiki can record for its major components.
FAQ
Can I configure logging over JMX?
No. The Logback versions XWiki ships no longer expose their configuration over JMX. Use the Logging Application for an immediate change, and logback.xml for one that survives a restart.
More
To find more about the current topic, you can search or use the table below and filter the columns to narrow your choices.