B4J Question How Use Log Stack Trace?

Jorge M A

Well-Known Member
Licensed User
Longtime User
Hello Experts!

The title refers to this attractive code written by @stevel05, Log Stack Trace, but I don't understand how to use it.

The problem I'm trying to solve is that one of my subs is being invoked multiple times and I can't find it from where.

My code is a bit complex and previously have to deal with some Sleep()s for refreshing screen elements.

Can someone show me how to use it and what parameters to set?
 

stevel05

Expert
Licensed User
Longtime User
As you are only interested in one sub, put the call as the first line in the sub and pass the Subname, set the limit to -1, this will log the whole stacktrace, you can limit it to as much as needed so you can see the information you want if there are too many items in the log.

This should show you where the call to the sub came from:

B4X:
Sub SubtoTrace
LogStackTrace("SubtoTrace",-1)

.'Other code
.
.

End Sub

The first line of the stacktrace should show you the sub it was called from.
 
Last edited:
Upvote 0
Top