J
Jacob
I have the following code in a class...
---------------------------------------------------------------------------------
....
Private _eL As EventLog = Nothing
Private _eLName As String = My.Settings.EventLogName
Private _sourceName As String
Private Sub New()
' Require user passes source name.
End Sub
Public Sub New(ByVal EventSourceName As String)
_eL = New EventLog(_eLName, My.Computer.Name, EventSourceName)
' This will ensure that the event source is registered w/ the EMSL
event log.
If EventLog.LogNameFromSourceName(EventSourceName,
My.Computer.Name).Trim.Length > 0 _
And EventLog.LogNameFromSourceName(EventSourceName, My.Computer.Name)
<> _eL.Log Then
EventLog.DeleteEventSource(EventSourceName, My.Computer.Name)
End If
_eL.CreateEventSource(EventSourceName, _eL.Log, My.Computer.Name)
_sourceName = EventSourceName
End Sub
....
Public Sub WriteEvent(ByVal Message As String, ByVal EventType As
EventLogEntryType, Optional ByVal ID As Integer = 68)
EventLog.WriteEntry(_sourceName, Message, EventType, ID)
End Sub
....
---------------------------------------------------------------------------------
The eventlog gets created, but the events are always written to the
Application eventlog.
Please, help.
Thanks,
Jacob
---------------------------------------------------------------------------------
....
Private _eL As EventLog = Nothing
Private _eLName As String = My.Settings.EventLogName
Private _sourceName As String
Private Sub New()
' Require user passes source name.
End Sub
Public Sub New(ByVal EventSourceName As String)
_eL = New EventLog(_eLName, My.Computer.Name, EventSourceName)
' This will ensure that the event source is registered w/ the EMSL
event log.
If EventLog.LogNameFromSourceName(EventSourceName,
My.Computer.Name).Trim.Length > 0 _
And EventLog.LogNameFromSourceName(EventSourceName, My.Computer.Name)
<> _eL.Log Then
EventLog.DeleteEventSource(EventSourceName, My.Computer.Name)
End If
_eL.CreateEventSource(EventSourceName, _eL.Log, My.Computer.Name)
_sourceName = EventSourceName
End Sub
....
Public Sub WriteEvent(ByVal Message As String, ByVal EventType As
EventLogEntryType, Optional ByVal ID As Integer = 68)
EventLog.WriteEntry(_sourceName, Message, EventType, ID)
End Sub
....
---------------------------------------------------------------------------------
The eventlog gets created, but the events are always written to the
Application eventlog.
Please, help.
Thanks,
Jacob