Hi, All,

So far I know two ways to log error message (as follows). I wish to know which is more stable.

Method 1 is provided by VB, it sounds better, but it causes my application behave unexpectedly sometimes(maybe I use it incorrectly). I wish to know your preference and your suggestion if you would like drop some lines.

Thank you very much!! Have a good weekend!




Method 1:

App.StartLogging "MyLogFilePath", 2
App.LogEvent "MyMessage", vbLogEventTypeInformation


Method 2:

Public Sub LogEvent ( ErrorMessage As String)
Dim FileNumber As Long
FileNumber = FreeFile
Open "\Error.log" For Append As #FileNumber
Print #FileNumber, ErrorMessage
Close #FileNumber
End Function

Call this method when needed.