Changes for page Debugging

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

<
From version < 9.1 >
edited by Caleb James DeLisle
on 2012/02/07 22:54
To version < 10.1 >
edited by Vincent Massol
on 2012/10/01 17:56
>
Change comment: Add quick Byteman tutorial for xwiki

Summary

Details

Page properties
Author
... ... @@ -1,1 +1,1 @@
1 -xwiki:XWiki.CalebJamesDeLisle
1 +xwiki:XWiki.VincentMassol
Content
... ... @@ -93,6 +93,43 @@
93 93  
94 94  See the [[Profiling page>>Profiling]] for more details on how to use the Aspect.
95 95  
96 +== Using Byteman ==
97 +
98 +[[Byteman>>https://www.jboss.org/byteman]] is a great framework that allows to modify bytecode in a running JVM. It can easily be used to add logging (for ex) to find out what's happening in a running XWiki instance. Here's a quick tutorial:
99 +* Download Byteman and unzip it in a directory. Set the ##$BYTEMAN_HOME## environment property to point to the directory where you've unzipped it. For example: {{code}}export BYTEMAN_HOME=/Users/vmassol/dev/byteman/byteman-download-2.1.0{{/code}}
100 +* Start an XWiki instance somewhere on the same machine
101 +* Go to ##$BYTEMAN_HOME/bin## and connect Byteman to XWiki. For example: {{code}}sh bminstall.sh -b -Dorg.jboss.byteman.transform.all jetty/start.jar{{/code}}
102 +* Now create a Byteman rule by creating a file, for example ##my.btm## with the following:(((
103 +{{code}}
104 +RULE XWiki Docs loaded
105 +CLASS XWikiHibernateStore
106 +METHOD loadXWikiDoc
107 +AT ENTRY
108 +IF TRUE
109 +DO traceln("Load document = " + $1.getDocumentReference())
110 +ENDRULE
111 +{{/code}}
112 +)))
113 +* Load this rule with: {{code}}sh bmsubmit.sh -l my.btm{{/code}}
114 +* Call a URL in your wiki and check that the console prints the SQL statements that get executed! For example:(((
115 +{{code}}
116 +Load document = xwiki:Main.WebPreferences
117 +Load document = xwiki:ColorThemes.DefaultColorTheme
118 +Load document = xwiki:XWiki.SearchSuggestConfig
119 +Load document = xwiki:XWiki.SearchSuggestConfig
120 +Load document = xwiki:Dashboard.WebHome
121 +Load document = xwiki:XWiki.GadgetClass
122 +Load document = xwiki:Dashboard.WebHome
123 +Load document = xwiki:Dashboard.WebPreferences
124 +Load document = xwiki:Dashboard.colibri
125 +Load document = xwiki:Main.Welcome
126 +...
127 +{{/code}}
128 +)))
129 +* Modify your rule or add new rules to the same file and apply the changed with {{code}}sh bmsubmit.sh -l my.btm{{/code}}
130 +
131 +For more read some [[Byteman tutorial>>https://community.jboss.org/wiki/ABytemanTutorial]] or the [[Reference documentation>>http://downloads.jboss.org/byteman/2.0.1/ProgrammersGuideSinglePage.html]].
132 +
96 96  = Debugging the WYSIWYG editor =
97 97  
98 98  == Debugging the Java code ==

Get Connected