Changes for page Logging

Last modified by Antoine Mottier on 2023/07/17

<
From version < 12.1 >
edited by Guillaume Fenollar
on 2012/07/26
To version < 12.2 >
edited by Manuel Smeria
on 2012/12/18
>
Change comment: Rewording, updated links

Summary

Details

Page properties
Author
... ... @@ -1,1 +1,1 @@
1 -XWiki.GuillaumeFenollar
1 +XWiki.ManuelSmeria
Content
... ... @@ -1,10 +1,12 @@
1 -{{box cssClass="floatinginfobox" title="**Contents**"}}{{toc/}}{{/box}}
1 +{{box cssClass="floatinginfobox" title="**Contents**"}}
2 +{{toc/}}
3 +{{/box}}
2 2  
3 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.
7 +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://raw.github.com/xwiki/xwiki-platform/master/xwiki-platform-core/xwiki-platform-web/src/main/resources/logback.xml]]## file.
6 6  
7 -XWiki is also configured by default so that any logs generated by 3rd part JARs used by XWiki (i.e. in the XWiki classpath at runtime) will automatically find their ways to the output defined by the Logback configuration file. This is active for Apache Commons Logging (JCL) and Log4J. This is achieved by using [[a SLF4J Bridge>>http://www.slf4j.org/legacy.html]] for both logging frameworks (it's the ##log4j-over-slf4j-*.jar## and ##jcl-over-slf4j-*.jar## JAR files that provide this feature).
9 +XWiki is also configured by default so that any logs generated by 3rd part JARs used by XWiki (i.e. in the XWiki classpath at runtime) will automatically find their ways to the output defined by the Logback configuration file. This is active for Apache Commons Logging (JCL) and Log4J. This is achieved by using [[a SLF4J Bridge>>http://www.slf4j.org/legacy.html]] for both logging frameworks (it's the ##log4j-over-slf4j-*.jar## and ##jcl-over-slf4j-*.jar## files that provide this feature).
8 8  
9 9  To customize the Logback configuration simply edit the file and restart the Servlet container for it to take effect.
10 10  
... ... @@ -14,7 +14,7 @@
14 14  
15 15  == Using JMX to change the logging configuration ==
16 16  
17 -[[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.
19 +[[LogBack exposes its configuration with JMX>>http://logback.qos.ch/manual/jmxConfig.html]] making it 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.
18 18  
19 19  See the [[Monitoring Guide>>AdminGuide.Monitoring]] for more details on using JMX with XWiki.
20 20  
... ... @@ -52,15 +52,15 @@
52 52  
53 53  == Using a different SLF4J implementation ==
54 54  
55 -If you wish, for example, to use Log4J to log all logs produced by XWiki you can do so by doing the following ([[described in the SLF4J manual>>http://www.slf4j.org/manual.html#binding]]):
56 -* Remove the Logback SLF4J implementation from the classpath by removing ##WEB-INF/lib/logback-classic-*.jar## and ##WEB-INF/lib/logback-core-*.jar##.
57 -* Remove the Log4J over SLF4J JAR from the classpath by removing ##WEB-INF/lib/log4j-over-slf4j-*.ja##.
57 +If you wish, for example, to use Log4J to log all logs produced by XWiki you can do so by doing the following ([[described in the SLF4J manual>>hhttp://www.slf4j.org/manual.html]]):
58 +* Remove the Logback SLF4J implementation from the classpath by removing ##WEB-INF/lib/logback-classic-*.jar## and ##WEB-INF/lib/logback-core-*.jar##
59 +* Remove the Log4J over SLF4J JAR from the classpath by removing ##WEB-INF/lib/log4j-over-slf4j-*.jar##
58 58  * Add the Log4J SLF4J implementation to the classpath: ##slf4j-log4j*-*.jar##
59 59  * Add Log4J itself to the classpath
60 60  
61 61  = For older XWiki versions =
62 62  
63 -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.
65 +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://raw.github.com/xwiki/xwiki-platform/13e01088e74c170452088a56fe54fb76a7ecb041/xwiki-platform-core/xwiki-platform-oldcore/src/main/resources/log4j.properties]]## file. XWiki' JAR is itself located in your ##WEB-INF/lib/## directory.
64 64  
65 65  {{info}}
66 66  By default XWiki is configured to log everything on the console only.
... ... @@ -119,21 +119,21 @@
119 119  XWiki has a feature to monitor times spent in its major components. To activate it, you need to:
120 120  
121 121  * Enable the Monitor plugin by adding/modifying the following plugin definition in the ##xwiki.cfg## configuration file:
122 -
124 +(((
123 123  {{code language="none"}}
124 124  xwiki.plugins=\
125 125   [...]
126 126   com.xpn.xwiki.monitor.api.MonitorPlugin
127 127  {{/code}}
128 -
130 +)))
129 129  * Enable it by adding/modifying the following in the ##xwiki.cfg## configuration file:
130 -
132 +(((
131 131  {{code language="none"}}
132 132  xwiki.monitor=1
133 133  {{/code}}
134 -
135 -* 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. (((
136 -
136 +)))
137 +* 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.
138 +(((
137 137  For example for Logback it means adding the following in ##logback.xml##:
138 138  
139 139  {{code language="none"}}

Get Connected