Re: EventLog.Source & Service Programs

From: David Williams , VB.NET MVP (davidd.NOSPAM.williams_at_earthlink.net)
Date: 06/29/04


Date: Tue, 29 Jun 2004 16:49:13 -0700

In your OnStart function:

Dim log As EventLog

If Not EventLog.SourceExists("ServiceSourceNameOfYourChoice") Then
     EventLog.CreateSource("ServiceSourceNameOfYourChoice")
End If
log = New EventLog("Application", "ServiceSourceNameOfYourChoice")

HTH

David Williams [VB.NET MVP]

"MAL" <irreverence2381@hotmail.com> wrote in message
news:a2aba623.0406282221.3cb7891@posting.google.com:
> Hello,
>
> I am writing a service program that writes to a custom EventLog. I
> would like the two classes used in the service to write messages to
> the same log ideally using a different Source name for filtering etc.
>
> So far I am having little luck. I feel that I have been through the
> documentation extensively but am chasing my tail. It seems like it
> should be as simple as .CreateEventSource in each class I want to
> write to the custom log, but to no avail.
>
> When I tried to just add one class to the service program, the service
> program wrote to the Application Log and the class wrote to the custom
> one, even though the service seemed to have created the log. (Based on
> a 5 minute timer before "Newing" my class) (.AutoLog = False) The code
> is straight from the service program and EventLog walkthroughs (which
> I end up using to clean things up (RemoveSource(s), DeleteLog) before
> my next service removal and reboot.
>
> The last thing I tried was creating a seperate EventLog in each class
> and trying to associate the source with the log the service created. I
> have attemted to pass a reference to the EventLog to the classes and
> then change the source like in the multithreaded examples. I have
> tried to bring the service pgms EventLog into scope in the classes.
> AHHHHHHH!!!
>
> I am obviously making this harder that it needs to be.
>
> Thanks for reading this rant. Please advise.



Relevant Pages

  • EventLog.Source & Service Programs
    ... I am writing a service program that writes to a custom EventLog. ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Service, Requested registry access is not allowed
    ... write to a custom event log and work fun running under Network Service. ... LocalSystem everything seems to work just fine. ... In that case you don't even need the installer. ... Service needs to write to a customized eventlog. ...
    (microsoft.public.dotnet.security)
  • Re: SCSI miniport-Custom Log messages
    ... Use this API-Functions for error logging in eventlog instead of your ... Make sure that you use the custom build step for your .mc file: ... Also make the necessary entries in the registry by your inf file. ... After installing this driver, an event is getting logged in the event log, ...
    (microsoft.public.development.device.drivers)
  • RE: .NET 1.1 created event log has only "Not available" properties
    ... are several missing registry values for the .NET created event logs. ... I understanding you're using the EventLog class to ... write entries into custom eventlog in .net 1.1 application. ... // Write an informational entry to the event log. ...
    (microsoft.public.dotnet.framework)
  • Can not replicate Parent/Child DCs and can not raise forest functional level to 2008
    ... FrancoiD wrote: ... Have a look at the eventlog to see if there are any replication errors. ... Microsoft MVP - Group Policy ...
    (microsoft.public.windows.server.active_directory)

Loading