Author: vmassol
Date: 2007-11-23 15:03:08 +0100 (Fri, 23 Nov 2007)
New Revision: 6051

Modified:
   
xwiki-platform/core/trunk/xwiki-core/src/main/java/com/xpn/xwiki/web/Utils.java
   xwiki-platform/core/trunk/xwiki-core/src/main/resources/log4j.properties
Log:
XWIKI-1881: Display the URL being called in xwiki logs


Modified: 
xwiki-platform/core/trunk/xwiki-core/src/main/java/com/xpn/xwiki/web/Utils.java
===================================================================
--- 
xwiki-platform/core/trunk/xwiki-core/src/main/java/com/xpn/xwiki/web/Utils.java 
    2007-11-22 16:38:45 UTC (rev 6050)
+++ 
xwiki-platform/core/trunk/xwiki-core/src/main/java/com/xpn/xwiki/web/Utils.java 
    2007-11-23 14:03:08 UTC (rev 6051)
@@ -230,7 +230,9 @@
         String dbname = "xwiki";
         URL url = XWiki.getRequestURL(request);
         context.setURL(url);
-        // Push the URL into the Log4j NDC context
+
+        // Push the URL into the Log4j MDC context so that we can display it 
in the generated logs using the
+        // %X{url} syntax.
         MDC.put("url", url);
 
         context.setEngineContext(engine_context);

Modified: 
xwiki-platform/core/trunk/xwiki-core/src/main/resources/log4j.properties
===================================================================
--- xwiki-platform/core/trunk/xwiki-core/src/main/resources/log4j.properties    
2007-11-22 16:38:45 UTC (rev 6050)
+++ xwiki-platform/core/trunk/xwiki-core/src/main/resources/log4j.properties    
2007-11-23 14:03:08 UTC (rev 6051)
@@ -2,14 +2,14 @@
 log4j.appender.stdout=org.apache.log4j.ConsoleAppender
 log4j.appender.stdout.Target=System.out
 log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
-log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} [%t] %-5p 
%-30.30c{2} %x - %m %n
+log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} [%X{url}] [%t] 
%-5p %-30.30c{2} %x - %m %n
 
 log4j.appender.file=org.apache.log4j.RollingFileAppender
 log4j.appender.file.File=xwiki.log
 log4j.appender.file.MaxFileSize=10MB
 log4j.appender.file.MaxBackupIndex=50
 log4j.appender.file.layout=org.apache.log4j.PatternLayout
-log4j.appender.file.layout.ConversionPattern=%d{ABSOLUTE} [%t] %-5p 
%-30.30c{2} %x - %m %n
+log4j.appender.file.layout.ConversionPattern=%d{ABSOLUTE} [%X{url}] [%t] %-5p 
%-30.30c{2} %x - %m %n
 
 ### By default everything that is of warning or severity WARN, ERROR or FATAL 
is logged both to
 ### the console and to the xwiki.log file.

_______________________________________________
notifications mailing list
[email protected]
http://lists.xwiki.org/mailman/listinfo/notifications

Reply via email to