VB.net · Method · ASP.net
application event log for console app
VB.net code to write a message to the Windows Application Event Log from a console application.
How to use application event log for console app:
After the snippet is in your project, call MyEventLog.
MyEventLog(New Exception("Process completed"), "Import finished successfully", EventLogEntryType.Information)
MyEventLog(New Exception("Database connection failed"), "Unable to connect to SQL Server", EventLogEntryType.Error)Private Sub MyEventLog(ex As Exception, msg As String, et As EventLogEntryType)
Dim e as string = "Console: FileTerminator"
Dim m as string = msg & " Exception: " & ex.Message
EventLog.WriteEntry(e, m, et)
End Sub