B4J Question Program crashes are logged,where?

HARRY

Active Member
Licensed User
Longtime User
Hi,
I have made a server program ( so non_UI), that runs very well for a couple of days and then crashes. Using systemd it is restarted and the program is written such that no data is lost, but still I would like to know why it crashes. I cannot find in what log file the reason of the crash is reported, such as division by zero, index out of range, impossible conversion, etc.
The programs runs on a Raspberry with raspbian installed.
Please, some help!
Harry
 
Last edited:

jmon

Well-Known Member
Licensed User
Longtime User
you should use the Application_Error Sub to catch your error and stackTrace and write it to a file:

B4X:
'Return true to allow the default exceptions handler to handle the uncaught exception.
Sub Application_Error (Error As Exception, StackTrace As String) As Boolean
    Log(Error)
    'write your error to file here
    Return True
End Sub
 
Last edited:
Upvote 0

billzhan

Active Member
Licensed User
Longtime User
It is possible that the server app is kill by Linux Out-of-Memory killer(Linux OS OOM killer). OOM killer is expected when low memory is available for OS.

You need to check files in /var/log/, this article describes in detail.
 
Upvote 0
Top