Changes for page Debugging
Last modified by Simon Urli on 2023/10/10 11:46
Change comment:
Add quick Byteman tutorial for xwiki
Summary
-
Page properties (2 modified, 0 added, 0 removed)
Details
- Page properties
-
- Author
-
... ... @@ -1,1 +1,1 @@ 1 -xwiki:XWiki. CalebJamesDeLisle1 +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 ==