Hi,
I am trying to create a class to write eventlogs on another computer.
It works fine when I don 't specify the log it needs to write in. Then the application will automatic take the "Application" log.
How can I create a new log on this other computer? (thru code!!!)
Thanks
This is my Error:Code:Public Sub error2Log(ByRef errorEvent As Exception, ByVal location As String) Dim log As New EventLog Dim mess As String log.MachineName = "B-MIS0-ROELANB" log.Log = "myAppLOg" '<-- This does not work !!! log.Source = Application.ExecutablePath mess = vbNewLine & "TIME: " & Now & vbNewLine & vbNewLine mess = mess & "DESCRIPTION: " & errorEvent.Message & vbNewLine & vbNewLine mess = mess & "LOCATION: " & location & vbNewLine log.WriteEntry(mess) log = Nothing End Sub
An unhandled exception of type 'System.ArgumentException' occurred in system.dll
Additional information:
The source 'C:\projects\CemaPrep\CemaPrep\bin\CemaPrep.exe' is
not registered in log 'myAppLOg'. (It is registered in log 'Application'.)
" The Source and Log properties must be matched,
or you may set Log to the empty string,
and it will automatically be matched to th




Reply With Quote