You need not add any other library.
This works whenever the program exists "normally" but not when the process is "killed".
1) In our normal Exe's this EXIT function/procedure is not executed when a run-time error is encountered because PostQuitMessage( 0 ) is used in the errosysw.prg.
In other words, EXIT procedure/function works after the main() function ends or after execution of a normal QUIT statement.
If PostQuitMessage(0) is executed, nothing in our program is executed and not even the EXIT procedure.
Another thing you may check is whether oLog:Add(...) function works after the log file is closed and if you are closing log file before the Main() function ends.