Been running a simple one Form VB EXP 2k8 app for several years which monitors a Serial Port data stream, updates some indicators on the Main Form, and captures specific key entries to forward back to the serial port ... I recently added some Roll over Balloons, a Help Form, and some Data Logging. At issue; the app now runs for around 8 hours then crashes with system level exception error (no error code) ... if I remove the code with a remark ' the app is stable again.
Data logging is done by calling me.DebugPrint instead of debug.print where DebugPrint checks a my.settings.LogFlag to determine if a logging is enabled ... log files are also only 1 day in length at 00:05 the current log file overwrites the previous days log file and a fresh log file is started
1) is there any way to determine what is actually failing
2) perhaps there is a better way to do the logging
Private Sub DebugPrint(ByRef stDebug As String)
Do While gloLock
Application.DoEvents()
Loop
If My.Settings.LogFlag And My.Settings.LogFile & "" <> "" Then
My.Computer.FileSystem.WriteAllText(My.Settings.LogFile, stDebug & vbCrLf, True)
End If
End Sub
Private Sub mvLogFile()
Dim src As String
Dim dst As String
src = My.Settings.LogFile
dst = src & ".bak"
Me.DebugPrint("Move: " & src & " - " & dst)
gloLock = True
If System.IO.File.Exists(dst) = True Then
System.IO.File.Delete(dst)
End If
If System.IO.File.Exists(src) = True Then
System.IO.File.Move(src, dst)
End If
gloLock = False
End Sub
Data logging is done by calling me.DebugPrint instead of debug.print where DebugPrint checks a my.settings.LogFlag to determine if a logging is enabled ... log files are also only 1 day in length at 00:05 the current log file overwrites the previous days log file and a fresh log file is started
1) is there any way to determine what is actually failing
2) perhaps there is a better way to do the logging
Private Sub DebugPrint(ByRef stDebug As String)
Do While gloLock
Application.DoEvents()
Loop
If My.Settings.LogFlag And My.Settings.LogFile & "" <> "" Then
My.Computer.FileSystem.WriteAllText(My.Settings.LogFile, stDebug & vbCrLf, True)
End If
End Sub
Private Sub mvLogFile()
Dim src As String
Dim dst As String
src = My.Settings.LogFile
dst = src & ".bak"
Me.DebugPrint("Move: " & src & " - " & dst)
gloLock = True
If System.IO.File.Exists(dst) = True Then
System.IO.File.Delete(dst)
End If
If System.IO.File.Exists(src) = True Then
System.IO.File.Move(src, dst)
End If
gloLock = False
End Sub