B4J Question How to log when runtimeexception occurs

HARRY

Active Member
Licensed User
Longtime User
In my program data is received via WiFi. This data is analyzed. Occasionaly a runtimexception occurs ( once per week). The exception then is StringIndexOutOfBound. I want to write the data to the logfile to investigate it, only when this error occurs. I use already RedirectOutput, so I get a complete java reporting on the error.
What should I do to see the data causing this error?
Harry
 

stevel05

Expert
Licensed User
Longtime User
Put the code in a try - catch block and log the lastexception

B4X:
try
    Code likely to fail
Catch
    Log(Data)
    Log(LastException)
End Try
 
Upvote 0
Top