Changes for page Debugging
Last modified by Simon Urli on 2023/10/10 11:46
Summary
-
Page properties (1 modified, 0 added, 0 removed)
Details
- Page properties
-
- Content
-
... ... @@ -33,9 +33,59 @@ 33 33 34 34 1.1 Logging 35 35 36 -Several possibilites: 37 -* Turn on logging in your database to see all SQL queries executed against it 38 -* Modify the ~~log4j.properties~~ properties file to add log calls in debug mode (by default only warnings and errors are logged). For example it's possible to turn on Hibernate logging in this manner. 36 +1.1.1 Turning on logging inside XWiki 39 39 40 -T ODO38 +XWiki uses Log4J and the XWiki JAR (xwiki.jar) located inside your ~~WEB-INF/lib/~~ contains a ~~log4j.properties~~ file containing the logging configuration. The best solution to modify it is to create a new ~~log4j.properties~~ file that you'll put in the ~~WEB-INF/classes~~ directory. It'll thus override the one from the XWiki JAR. As an example, here's a sample configuration: 41 41 40 +{code} 41 +\#\#\# Direct log messages to stdout 42 +log4j.appender.stdout=org.apache.log4j.ConsoleAppender 43 +log4j.appender.stdout.Target=System.out 44 +log4j.appender.stdout.layout=org.apache.log4j.PatternLayout 45 +log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} %5p %t %X{url} %c{1}:%M:%L - %m%n 46 + 47 +log4j.appender.file=org.apache.log4j.RollingFileAppender 48 +log4j.appender.file.File=xwiki.log 49 +log4j.appender.file.MaxFileSize=10MB 50 +log4j.appender.file.MaxBackupIndex=50 51 +log4j.appender.file.layout = org.apache.log4j.PatternLayout 52 +log4j.appender.file.layout.ConversionPattern = %d{ABSOLUTE} [%t] %-5p %-30.30c{2} %x - %m %n 53 + 54 +\#\#\# By default everything that is of warning or severity WARN, ERROR or FATAL is logged both to 55 +\#\#\# the console and to the xwiki.log file. 56 +log4j.rootLogger=warn, stdout, file 57 + 58 +\#\#\# Hibernate logging options 59 +log4j.logger.org.hibernate=warn 60 +log4j.logger.org.hibernate.SQL=warn 61 +log4j.logger.org.hibernate.type=warn 62 +log4j.logger.org.hibernate.ps.PreparedStatementCache=warn 63 + 64 +\#\#\# XWiki logging configuration 65 +log4j.logger.com.xpn.xwiki=warn 66 +log4j.logger.com.xpn.xwiki.render.XWikiRadeoxRenderEngine=warn 67 + 68 +\#\#\# Deactivate Radeox warnings 69 +log4j.logger.org.radeox.macro.BaseLocaleMacro=error 70 + 71 +\#\#\# Deactivate Struts warnings 72 +log4j.logger.org.apache.struts.util.RequestUtils=error 73 + 74 +\#\#\# Deactivate JGroups warnings 75 +log4j.logger.org.jgroups=error 76 +{code} 77 + 78 +Refer to Log4J's documentation to understand the settings. As an example, to turn on Hibernate's calls, just set the following: 79 + 80 +{code} 81 +log4j.logger.org.hibernate.SQL=debug 82 +{code} 83 + 84 +1.1.1 Logging calls at the database level 85 + 86 +Turn on logging in your database to see all SQL queries executed against it. 87 + 88 +#info("The configuration is database-dependent. Please add how to do it for different database here.") 89 + 90 + 91 +