Wiki source code of Monitor Component Execution Times
Last modified by Eleni Cojocariu on 2026/11/24 18:38
Show last authors
| author | version | line-number | content |
|---|---|---|---|
| 1 | Record how long XWiki's major components spend on each request, by turning on the Monitor plugin and letting it write its measurements to [[the log>>doc:documentation.xs.admin.logging.file-locations.WebHome]]. | ||
| 2 | |||
| 3 | 1. Check that the plugin is in the plugin list of ##WEB-INF/xwiki.cfg##. It is in the list XWiki ships, so this is normally already done.((( | ||
| 4 | {{code language="none"}} | ||
| 5 | xwiki.plugins=\ | ||
| 6 | [...] | ||
| 7 | com.xpn.xwiki.monitor.api.MonitorPlugin | ||
| 8 | {{/code}} | ||
| 9 | ))) | ||
| 10 | 1. Turn the plugin on in the same file. The setting is shipped commented out and defaults to off, so the plugin is loaded but measures nothing until you do this. ##xwiki.monitor.lastlistsize## decides how many recent requests it keeps, and defaults to 20.((( | ||
| 11 | {{code language="none"}} | ||
| 12 | xwiki.monitor=1 | ||
| 13 | {{/code}} | ||
| 14 | ))) | ||
| 15 | 1. Raise the plugin's logger to ##debug##, since that is the level it writes its measurements at. Apply it in the Logback configuration file, as described in [[Configure Log Levels>>doc:documentation.xs.admin.logging.configure-levels.WebHome]].((( | ||
| 16 | {{code language="xml"}} | ||
| 17 | <logger name="com.xpn.xwiki.monitor" level="debug"/> | ||
| 18 | {{/code}} | ||
| 19 | ))) | ||
| 20 | 1. Restart the servlet container, since both changes are read at start-up. | ||
| 21 | 1. Browse the wiki and read the log. Each request now produces a ##MONITOR## record with its total duration, followed by one record per timer with the time spent there and the number of calls.((( | ||
| 22 | {{code language="none"}} | ||
| 23 | 2026-11-10 16:12:51,830 [qtp927327686-166] DEBUG c.x.x.m.a.MonitorData - MONITOR page [Sandbox.WebHome]: [243]ms | ||
| 24 | 2026-11-10 16:12:51,830 [qtp927327686-166] DEBUG c.x.x.m.a.MonitorData - MONITOR page [Sandbox.WebHome], action [view], timer [hibernate]: [86]ms in [14] calls | ||
| 25 | {{/code}} | ||
| 26 | ))) |