Wiki source code of Analyze Logs with Lilith

Last modified by superadmin on 2026/11/24 18:40

Hide last authors
Eleni Cojocariu 1.1 1 Send XWiki's log events to [[Lilith>>https://github.com/huxi/lilith]], a desktop viewer that makes a large volume of events searchable, instead of reading [[the log file>>doc:documentation.xs.admin.logging.file-locations.WebHome]] line by line.
2
3 1. Install Lilith and start it. It listens on port 4560 out of the box, so there is nothing to configure on its side.
4 1. Declare a Logback socket appender in the Logback configuration file. Set ##RemoteHost## to the machine Lilith runs on, which is not necessarily the one XWiki runs on.(((
5 {{code language="xml"}}
6 <appender name="socket" class="ch.qos.logback.classic.net.SocketAppender">
7 <RemoteHost>localhost</RemoteHost>
8 <Port>4560</Port>
9 <ReconnectionDelay>170</ReconnectionDelay>
10 </appender>
11 {{/code}}
12 )))
13 1. Reference that appender from the root logger, beside the console one, so the events go to both.(((
14 {{code language="xml"}}
15 <root level="warn">
16 <appender-ref ref="stdout"/>
17 <appender-ref ref="socket"/>
18 </root>
19 {{/code}}
20 )))
21 1. Restart the servlet container.
22 1. Lilith fills with XWiki's events as the instance starts, one row per record, colour-coded by level. Selecting a row shows its full message, logger and thread below, and for a page request the thread name is the URL being served.(((
23 {{image reference="lilith-log-viewer.png" size="extra" alt="The Lilith window listing XWiki log events, with the details of the selected event below"/}}
24 )))
25
26 [[Raising a logger to DEBUG>>doc:documentation.xs.admin.logging.change-levels-runtime.WebHome]] while Lilith is connected is the usual way to use it: the events collect in Lilith to be searched there, instead of scrolling past in the console.

Get Connected