Changes for page Debugging

Last modified by Simon Urli on 2023/10/10 11:46

From version 6.1
edited by JeromeVelociter
on 2009/09/23 16:39
Change comment: There is no comment for this version
To version 7.1
edited by Marius Dumitru Florea
on 2010/03/29 17:07
Change comment: Document converted from syntax xwiki/1.0 to syntax xwiki/2.0

Summary

Details

Page properties
Author
... ... @@ -1,1 +1,1 @@
1 -xwiki:XWiki.JeromeVelociter
1 +xwiki:XWiki.mflorea
Syntax
... ... @@ -1,1 +1,1 @@
1 -XWiki 1.0
1 +XWiki 2.0
Content
... ... @@ -1,45 +1,46 @@
1 -1 Debugging
1 += Debugging =
2 2  
3 3  There are several possibilities for debugging XWiki:
4 -#toc("" "" "")
5 5  
6 -1.1 Debugging XWiki from your IDE
5 +{{toc start="" depth="" numbered=""/}}
7 7  
8 -1.1.1 Debugging with Eclipse
7 +== Debugging XWiki from your IDE ==
9 9  
9 +=== Debugging with Eclipse ===
10 +
10 10  Once you've gotten the debugger working, you'll wonder how you ever survived without it.
11 11  
12 -1.1.1.1 Complete tutorial based on M2Eclipse and WTP
13 +==== Complete tutorial based on M2Eclipse and WTP ====
13 13  
14 -[Debug XWiki with Eclipse>Community.DebugXEWithEclipse]
15 +[[Debug XWiki with Eclipse>>Community.DebugXEWithEclipse]]
15 15  
16 -1.1.1.1 Debug a XWiki released version
17 +==== Debug a XWiki released version ====
17 17  
18 -* Follow the steps in under [BuildingInEclipse] including the optional "Import the WAR as a web project".
19 -* Select from the Eclipse menu *Run > Debug...*
19 +* Follow the steps in under [[BuildingInEclipse]] including the optional "Import the WAR as a web project".
20 +* Select from the Eclipse menu **Run > Debug...**
20 20  * Create a new configuration for your server
21 21  * Hit the Debug button
22 22  * Set breakpoints, step through code, have fun!
23 23  
24 -WTP will deploy XWiki into <tt>\{workspace_location\}/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/webapps/xwiki</tt>. If you suspect a change has not been deployed correctly (e.g. a change to a config file), check there to confirm.
25 +WTP will deploy XWiki into ##{workspace_location}/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/webapps/xwiki##. If you suspect a change has not been deployed correctly (e.g. a change to a config file), check there to confirm.
25 25  
26 -If you are working on an XWiki plugin in a separate project in your workspace, you can ensure it is automatically deployed to XWiki's <tt>WEB-INF/lib</tt> directory when debugging. Open the project properties of the XWiki project resulting from the WAR import above, go to the <tt>J2EE Module Dependencies</tt> section, and add your plugin project.
27 +If you are working on an XWiki plugin in a separate project in your workspace, you can ensure it is automatically deployed to XWiki's ##WEB-INF/lib## directory when debugging. Open the project properties of the XWiki project resulting from the WAR import above, go to the ##J2EE Module Dependencies## section, and add your plugin project.
27 27  
28 -1.1.1.1 Using Firebug when debugging a selenium test
29 +==== Using Firebug when debugging a selenium test ====
29 29  
30 30  For that you will need to install Firebug as a global extension. See http://kb.mozillazine.org/Installing_extensions#Global_installation
31 31  
32 -1.1 Remote Debugging
33 +== Remote Debugging ==
33 33  
34 34  To perform remote debugging, start you wiki in debug mode. To do this modify the way you start your container and ensure that the following JVM parameters are passed:
35 35  
36 -{code}
37 +{{code}}
37 37  -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005
38 -{code}
39 +{{/code}}
39 39  
40 40  For example, for Jetty you could use the following start script:
41 41  
42 -{code}
43 +{{code}}
43 43  #!/bin/sh
44 44  
45 45  JETTY_HOME=.
... ... @@ -47,49 +47,48 @@
47 47  JAVA_OPTS="-Xmx300m -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005"
48 48  
49 49  java $JAVA_OPTS -Dfile.encoding=iso-8859-1 -Djetty.port=$JETTY_PORT -Djetty.home=$JETTY_HOME -jar $JETTY_HOME/start.jar
50 -{code}
51 +{{/code}}
51 51  
52 -#info("You can also easily run Jetty in debug mode by using the [jettyrun profile in the Maven build>Community.Building#HExecutingtheStandardWebWARquicklyindevelopmentmode].")
53 +{{info}}
54 +You can also easily run Jetty in debug mode by using the [[jettyrun profile in the Maven build>>Community.Building#HExecutingtheStandardWebWARquicklyindevelopmentmode]].
55 +{{/info}}
53 53  
54 -If you are using the Tomcat service on Windows, you should modify the JVM args with the Tomcat Service Configuration Panel. Select the Java tab and add each of the options *on a separate line*. For example:
57 +If you are using the Tomcat service on Windows, you should modify the JVM args with the Tomcat Service Configuration Panel. Select the Java tab and add each of the options **on a separate line**. For example:
55 55  
56 -{code}
57 --Dcatalina.home=C:\\\Program Files\\\Apache Software Foundation\\\Tomcat 5.5
58 --Dcatalina.base=C:\\\Program Files\\\Apache Software Foundation\\\Tomcat 5.5
59 --Djava.endorsed.dirs=C:\\\Program Files\\\Apache Software Foundation\\\Tomcat 5.5\\\common\\\endorsed
60 --Djava.io.tmpdir=C:\\\Program Files\\\Apache Software Foundation\\\Tomcat 5.5\\\temp
59 +{{code}}
60 +-Dcatalina.home=C:\Program Files\Apache Software Foundation\Tomcat 5.5
61 +-Dcatalina.base=C:\Program Files\Apache Software Foundation\Tomcat 5.5
62 +-Djava.endorsed.dirs=C:\Program Files\Apache Software Foundation\Tomcat 5.5\common\endorsed
63 +-Djava.io.tmpdir=C:\Program Files\Apache Software Foundation\Tomcat 5.5\temp
61 61  -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
62 --Djava.util.logging.config.file=C:\\\Program Files\\\Apache Software Foundation\\\Tomcat 5.5\\\conf\\\logging.properties
65 +-Djava.util.logging.config.file=C:\Program Files\Apache Software Foundation\Tomcat 5.5\conf\logging.properties
63 63  -Xdebug
64 64  -Xnoagent
65 65  -Djava.compiler=NONE
66 66  -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n
67 -{code}
70 +{{/code}}
68 68  
69 -Then, in your favorite IDE, open the XWiki project and run a remote debugging session, attached to the socket on port 5005. For example, using IntelliJ IDEA, go to <tt>Run|Edit Configurations...</tt> and create a new <tt>Remote</tt> configuration (default parameters should be fine). Then execute it and IDEA will connect to the executing JVM.
70 -
72 +Then, in your favorite IDE, open the XWiki project and run a remote debugging session, attached to the socket on port 5005. For example, using IntelliJ IDEA, go to ##Run|Edit Configurations...## and create a new ##Remote## configuration (default parameters should be fine). Then execute it and IDEA will connect to the executing JVM.
71 71  You can then place breakpoints in your source code.
72 72  
75 +== Logging ==
73 73  
74 -1.1 Logging
77 +=== Turning on logging inside XWiki ===
75 75  
76 -1.1.1 Turning on logging inside XWiki
79 +See the [[Logging page in the Admin guide>>platform:AdminGuide.Logging]].
77 77  
78 -See the [Logging page in the Admin guide>platform:AdminGuide.Logging].
81 +=== Logging calls at the database level ===
79 79  
80 -1.1.1 Logging calls at the database level
81 -
82 82  Turn on logging in your database to see all SQL queries executed against it.
83 83  
84 -#info("The configuration is database-dependent. Please add how to do it for different database here.")
85 +{{info}}
86 +The configuration is database-dependent. Please add how to do it for different database here.
87 +{{/info}}
85 85  
86 -1.1.1 Generating a debug version of XWiki
89 +=== Generating a debug version of XWiki ===
87 87  
88 -Our Maven2 build has support for running a Log Aspect against XWiki's core. This Log Aspect logs all method calls with parameters. This is useful, especially in the case when you cannot debug the application (for example when you cannot reproduce the problem on your machine you can send an "aspectified" XWiki JAR and ask the user to run it and send you the logs). Note that you'll need to ask the user to add the AspectJ Runtime JAR to his <tt>WEB-INF/lib</tt> directory too.
91 +Our Maven2 build has support for running a Log Aspect against XWiki's core. This Log Aspect logs all method calls with parameters. This is useful, especially in the case when you cannot debug the application (for example when you cannot reproduce the problem on your machine you can send an "aspectified" XWiki JAR and ask the user to run it and send you the logs). Note that you'll need to ask the user to add the AspectJ Runtime JAR to his ##WEB-INF/lib## directory too.
89 89  
90 -To generate the aspectified XWiki JAR, run <tt>mvn install -Pdebug</tt> in XWiki's Core module directory.
93 +To generate the aspectified XWiki JAR, run ##mvn install -Pdebug## in XWiki's Core module directory.
91 91  
92 -See the [Profiling page>Profiling] for more details on how to use the Aspect.
93 -
94 -
95 -
95 +See the [[Profiling page>>Profiling]] for more details on how to use the Aspect.

Get Connected