RE: EventLog Source still created after deleting all references to it

From: cmoore.afs (cmoore.afs_at_discussions.microsoft.com)
Date: 03/14/05


Date: Mon, 14 Mar 2005 12:21:04 -0800

Something very similar is happening to me. I created a source and used the
application log for logging errors. I decided to write a custom log for
these errors and it doesn't work when I give it the source name as it use to
be. I have deleted all references that I could find related to the source
name, but everytime I recreate it I can only successfully log to the
application log and not my custom log.

I have deleted the source using EventLog.DeleteEventSource(SOURCENAME) and
it appears to be deleted until I try to recreate it and write to my custom
log using that sourcename. I have deleted the refrences in the registry as
well and same exact thing happens. It seems that even though the source is
deleted it has some reference to the old log that it was associated with.
Any advice on this issue?

Here is ex code I am using:
if(!EventLog.SourceExists(source))
                        {
                                EventLog.CreateEventSource(source, "TTLog");
                        }
                
                        // Create an EventLog instance and assign its source.
                        EventLog myLog = new EventLog();
                        myLog.Source = source;
        
                        // Write an informational entry to the event log.
                        myLog.WriteEntry(errorMessage, EventLogEntryType.Error);

Whenever I do this, it my error is logged in the application log as:
The description for Event ID ( 0 ) in Source ( SOURCENAME) cannot be found.
The local computer may not have the necessary registry information or message
DLL files to display messages from a remote computer. You may be able to use
the /AUXSOURCE= flag to retrieve this description; see Help and Support for
details. The following information is part of the event: ERROR MESSAGE
APPEARS HERE
"Next" wrote:

> Hello all,
>
> I have a windows service that was suppose to write some events into its own
> EventLog.
>
> I created the EventLog using the component on VS 2003 toolbar
> Added an installer for it.
> Set all the appropriate properties to assign the new Source to a new log.
>
> For some reason installutil.exe created the source in the correct log. But
> then tried to create the same source in the Application log.
>
> This of course caused the installation to rollback because the source
> already existed.
>
> I couldn't figure out what was going on, so I deleted ALL of my eventlog
> instances and anything else that had to do with the EventLog.
>
> InstallUtil is now creating my new source in the Application log. I have
> searched, deleted, rebuilt,...but there are no references to any EventLog or
> my new source.
>
> Can anybody shed some light on where any other EventLog code could be?
>
> Aaron
>
>
>



Relevant Pages

  • Re: Service, Requested registry access is not allowed
    ... I agree, Joe, it is not a great idea to elevate rights to circumvent access ... eventlog assuming that the user installing the service has appropriate ... In that case you don't even need the installer. ...
    (microsoft.public.dotnet.security)
  • 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: MMC-Programme etc. starten nicht bei Win2003
    ... Hast Du schon einmal probiert über das Netzwerk von einer Workstation aus auf das Eventlog zugriff zu erlangen? ... Irgend eine Meldung muss ja im Eventlog stehen. ... Eventuell ist ja der Installer Dienst defekt. ... macht man das von einer dedizierten Workstation aus. ...
    (microsoft.public.de.german.windows.server.general)
  • RE: Windows Service AutoStart Problem (C#)
    ... I used a custom log in the eventlog and the ... > needed" radio button is selected; this radio button is located in the Log ... > Jeffrey Tan ...
    (microsoft.public.dotnet.framework.windowsforms)
  • Solution: web application can not access event log
    ... Nicole and Joseph put me on the correct track. ... Then in my web application I did a EventLog el = new ... and the custom log was written without issue with the web application running ... > then try to execute these two lines of code: ...
    (microsoft.public.dotnet.security)