EventLog.WriteEntry(source, message) does not write to source

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Jacob

    #1

    EventLog.WriteEntry(source, message) does not write to source

    I have the following code in a class...

    ---------------------------------------------------------------------------------
    ....
    Private _eL As EventLog = Nothing
    Private _eLName As String = My.Settings.Eve ntLogName
    Private _sourceName As String

    Private Sub New()
    ' Require user passes source name.
    End Sub
    Public Sub New(ByVal EventSourceName As String)
    _eL = New EventLog(_eLNam e, My.Computer.Nam e, EventSourceName )

    ' This will ensure that the event source is registered w/ the EMSL
    event log.
    If EventLog.LogNam eFromSourceName (EventSourceNam e,
    My.Computer.Nam e).Trim.Length 0 _
    And EventLog.LogNam eFromSourceName (EventSourceNam e, My.Computer.Nam e)
    <_eL.Log Then
    EventLog.Delete EventSource(Eve ntSourceName, My.Computer.Nam e)
    End If

    _eL.CreateEvent Source(EventSou rceName, _eL.Log, My.Computer.Nam e)
    _sourceName = EventSourceName
    End Sub
    ....
    Public Sub WriteEvent(ByVa l Message As String, ByVal EventType As
    EventLogEntryTy pe, Optional ByVal ID As Integer = 68)
    EventLog.WriteE ntry(_sourceNam e, Message, EventType, ID)
    End Sub

    ....
    ---------------------------------------------------------------------------------

    The eventlog gets created, but the events are always written to the
    Application eventlog.

    Please, help.

    Thanks,
    Jacob

  • Jacob

    #2
    Re: EventLog.WriteE ntry(source, message) does not write to source

    Never mind...
    The source had an illegal character.
    thanks anyway.

    Comment

    Working...