Exception Logging to the Event Log

/ Published in: Visual Basic
Save to your folder(s)

A helper class which adds the ability to log exceptions to the Windows event log, including the class and method in which they occurred, to a class that derives from it.
The event source name defaults to the application title, but can be overridden by passing a string to the constructor (i.e. MyBase.New("MyApp") in the derived class).


Public Class Test
Inherits ExceptionLogger

Public Sub Test()
Throw New ApplicationException("Test exception", New Exception("Test inner exception"))
Catch ex As Exception
End Try
End Sub
End Class

Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.