Need Help writing to event log.
Hello All,
I need help writing to the event log.
The problem I ran into is writing to a folder under Applications and Services. Here is the path I want to write to:
Code:
Event Viewer (Local)\Applications and Services\MDTech\Program Name\
I can't find a way to create a sub folder and write to it!
Maxwell.
P.S. Happy New Year!
Re: Need Help writing to event log.
How are you attempting to write to it now and from what type of application? Which version of VB/framework are you using?
Re: Need Help writing to event log.
Quote:
Originally Posted by
DataMiser
How are you attempting to write to it now and from what type of application? Which version of VB/framework are you using?
1) This is a new program so I don't write to the event log at all now. But, I will most likely use the EventLog type.
2) I am using VB.NET 2012, but with the target framework set to 4.0.
Maxwell.
P.S. Happy New Year!
Re: Need Help writing to event log.
What type of application? Is it a Service, a console app, a windows forms app web service... or what?
Re: Need Help writing to event log.
Quote:
Originally Posted by
DataMiser
What type of application? Is it a Service, a console app, a windows forms app web service... or what?
It actually is a service, but I think everything that works on a win forms app also works on services.
Maxwell.
P.S. Happy New Year!
Re: Need Help writing to event log.
I'm confused if you are not writing to the event log at all then what problem are you having? Have you tried anything?
The process is pretty simple, just add the Event Log to your service and write to it
Code:
Me.EventLog.WriteEntry("Input path=" & WatchPath & vbCrLf & "Extension=" & WatchExtension)
I'm not sure what you mean by the path.
1 Attachment(s)
Re: Need Help writing to event log.
Quote:
Originally Posted by
DataMiser
I'm confused if you are not writing to the event log at all then what problem are you having? Have you tried anything?
The process is pretty simple, just add the Event Log to your service and write to it
Code:
Me.EventLog.WriteEntry("Input path=" & WatchPath & vbCrLf & "Extension=" & WatchExtension)
I'm not sure what you mean by the path.
I am trying to create an event not under the Application log but under a separate log that I also want to use for any future programs. Such as Microsoft's services write to a separate log under the Microsoft folder.
Maxwell.
P.S.Attachment 94711
Re: Need Help writing to event log.
Perhaps you can use the info here http://www.codeguru.com/columns/vb/a...s-in-VBNET.htm to do what you need.