Changes for page Debugging

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

From version 38.1
edited by Vincent Massol
on 2019/03/23 19:28
Change comment: There is no comment for this version
To version 39.1
edited by Vincent Massol
on 2019/03/23 19:59
Change comment: There is no comment for this version

Summary

Details

Page properties
Content
... ... @@ -203,8 +203,10 @@
203 203  
204 204  For more read [[A Byteman tutorial>>https://community.jboss.org/wiki/ABytemanTutorial]] or the [[Reference documentation>>http://downloads.jboss.org/byteman/2.0.1/ProgrammersGuideSinglePage.html]].
205 205  
206 -=== Example ===
206 +=== Examples ===
207 207  
208 +==== Example 1 ====
209 +
208 208  In this example we'll print calls to ##CommonsConfigurationSource.containsKey(...)## with the parameters printed and the time it takes to execute. In addition we'll also print calls to ##XWiki.getDocument(String, XWikiContext)## which is a deprecated method which, for the purpose of this example, we think generate the calls to ##containsKey##.
209 209  
210 210  {{code}}
... ... @@ -254,6 +254,36 @@
254 254  ...
255 255  {{/code}}
256 256  
259 +==== Example 2 ====
260 +
261 +Log calls to ##XWikiDocument#setLock()## and ##XWikiDocument#removeLock()##.
262 +
263 +{{code}}
264 +RULE XWiki Set Lock
265 +CLASS XWikiDocument
266 +METHOD setLock
267 +AT ENTRY
268 +IF TRUE
269 +DO traceln("set lock for user [" + $1 + "], doc = [" + $this + "]")
270 +ENDRULE
271 +
272 +RULE XWiki Remove Lock
273 +CLASS XWikiDocument
274 +METHOD removeLock
275 +AT ENTRY
276 +IF TRUE
277 +DO traceln("remove lock for doc = [" + $this + "]")
278 +ENDRULE
279 +{{/code}}
280 +
281 +When you click edit and then save on a doc you get for example:
282 +
283 +{{code}}
284 +set lock for user [XWiki.Admin], doc = [Sandbox.WebHome]
285 +set lock for user [XWiki.Admin], doc = [Sandbox.WebHome]
286 +remove lock for doc = [Sandbox.WebHome]
287 +{{/code}}
288 +
257 257  === Troubleshooting ===
258 258  
259 259  ==== NoClassDefFoundError: com/sun/tools/attach/AttachNotSupportedException ====

Get Connected