I would like to log a stack trace in my application not due to a software issue but to know how my program ended up producing a wrong output due to user inteaction.
I know I can create and raise an exception then catch the exception and look at the stack. Is there an easier way - without having to raise an exception?
Hanspeter
raise an exception and catch it:
try
raise new RuntimeException
catch r as RuntimeException
MsgBox join(r.Stack, EndOfLine)
end try
Danke - Thanks Christian.
I hoped there would be someting like app.stack and I would not have to raise an exception - but this should not hurt anything.
Feel free to copy this in a function in a module or in app class.
Just want to chime in here - shouldn’t “Include Function Names” be enabled for this to work in a compiled app?
At Xojodevspot.com in the downloads is a stackcleaner module to make a trace all “readable”. It was created by Bob a few years ago.
Aside- (Pretty sad there’s hundreds of sources available and I remember most code or can recognize the author of particular code by the “style its written in”…Maybe a fun game could come of this for long time xojo devs?! Such as long time gone aaron b’s enclosures always include spaces after and before parenthesis :-p)