Changes for page Logging

Last modified by Antoine Mottier on 2023/07/17

From version 7.1
edited by Ricardo Rodríguez
on 2010/12/13
Change comment: There is no comment for this version
To version 8.1
edited by Vincent Massol
on 2011/05/19
Change comment: Added new logging configuration

Summary

Details

Page properties
Author
... ... @@ -1,1 +1,1 @@
1 -XWiki.rrodriguez
1 +XWiki.VincentMassol
Content
... ... @@ -1,13 +1,31 @@
1 1  {{box cssClass="floatinginfobox" title="**Contents**"}}{{toc/}}{{/box}}
2 2  
3 -XWiki uses Commons Logging for logging. By default XWiki is configured so that Commons Logging uses log4J. XWiki's Log4J configuration is located inside XWiki's JAR (xwiki-core-x.y.jar), in a ##[[log4j.properties>>http://fisheye2.cenqua.com/browse/raw,r=trunk/xwiki/xwiki-platform/core/trunk/src/main/resources/log4j.properties]]## file. XWiki' JAR is itself located in your ##WEB-INF/lib/## directory.
3 += For XWiki 3.1 and beyond =
4 4  
5 +Starting with version 3.1 XWiki logs using [[SLF4J>>http://www.slf4j.org/]]. By default XWiki is configured so that SLF4J uses [[Logback>>http://logback.qos.ch/]]. XWiki's Logback configuration is located in the ##[[WEB-INF/classes/logback.xml>>https://github.com/xwiki/xwiki-platform/raw/master/xwiki-platform-core/xwiki-platform-web/src/main/resources/logback.xml]]## file.
6 +
7 +To customize the Logback configuration simply edit the file and restart the Servlet container for it to take effect.
8 +
5 5  {{info}}
6 -By default XWiki is configured to log everything both on the console and in a xwiki.log file located in the directory from where you have started the JVM. This is usually the directory from where you have started your application server/Servlet container. It's recommended to either start the JVM from a location where it's ok to output the xwiki.log file or to create a custom Log4J configuration as explained below.
10 +By default XWiki is configured to log everything on the console only.
7 7  {{/info}}
8 8  
9 -= Using a custom Log4J configuration =
13 +== Using JMX to change the logging configuration ==
10 10  
15 +[[LogBack exposes its configuration with JMX>>http://logback.qos.ch/manual/jmxConfig.html]] and thus it's possible to use a JMX console to modify the logging configuration at runtime, thus not needing to restart the Servlet container. This is very useful in production when needing to debug an issue.
16 +
17 +See the [[Monitoring Guide>>AdminGuide.Monitoring]] for more details on using JMX with XWiki.
18 +
19 += For older XWiki versions =
20 +
21 +XWiki versions 3.0 and older use Commons Logging for logging. By default XWiki is configured so that Commons Logging uses log4J. XWiki's Log4J configuration is located inside XWiki's JAR (xwiki-core-x.y.jar), in a ##[[log4j.properties>>https://github.com/xwiki/xwiki-platform/raw/13e01088e74c170452088a56fe54fb76a7ecb041/xwiki-platform-core/xwiki-platform-oldcore/src/main/resources/log4j.properties]]## file. XWiki' JAR is itself located in your ##WEB-INF/lib/## directory.
22 +
23 +{{info}}
24 +By default XWiki is configured to log everything on the console only.
25 +{{/info}}
26 +
27 +== Using a custom Log4J configuration ==
28 +
11 11  The best solution is to create a new ##log4j.properties## file in your ##WEB-INF/classes## directory. It'll thus override the one from the XWiki JAR. As an example, here's a sample configuration:
12 12  
13 13  {{code language="none"}}
... ... @@ -50,7 +50,7 @@
50 50  log4j.logger.org.hibernate.SQL=debug
51 51  {{/code}}
52 52  
53 -= Activating the XWiki monitoring feature =
71 += Activating the XWiki Monitoring feature =
54 54  
55 55  {{info}}
56 56  The monitoring feature is already active in the default configuration.
... ... @@ -72,8 +72,16 @@
72 72  xwiki.monitor=1
73 73  {{/code}}
74 74  
75 -* Since the plugin logs everything under the ##DEBUG## severity you also need to configure Log4J (as described above) by adding the following in ##log4j.properties##:
93 +* Since the plugin logs everything under the ##DEBUG## severity you also need to configure the XWiki Logging (as described above) by setting the ##com.xpn.xwiki.monitor## category to the ##DEBUG## level. (((
76 76  
95 +For example for Logback it means adding the following in ##logback.xml##:
96 +
77 77  {{code language="none"}}
98 +{{/code}}
99 +
100 +And for older XWiki versions using Log4J it means adding the following in ##log4j.properties##:
101 +
102 +{{code language="none"}}
78 78  log4j.logger.com.xpn.xwiki.monitor=debug
79 79  {{/code}}
105 +)))

Get Connected