I am trying to write some test code to simulated a blue screen application event log entry. I have the generic function

private void AddEventLogEntry(string source, string errorText, int eventId, short category)
        {
            string log = "Application";

            if (!EventLog.SourceExists(source))
                EventLog.CreateEventSource(source, log);

            EventLog.WriteEntry(source, errorText,
                EventLogEntryType.Information, eventId, category);
        }

This will write any source entry to the application event log until I try with source name "Save Dump" when for some reason windows puts this in the system event log.

Example

AddEventLogEntry("Save Dump",  "error text",  1, 4);

Any ideas how to get a Source of "Save Dump" in the application event log.

Thanks!

Edited 7 Years Ago by cstrachan: n/a

Not sure if this is your problem, but the documentation indicates you should create the event source during installation of the application:

Create the new event source during the installation of your application. This allows time for the operating system to refresh its list of registered event sources and their configuration. If the operating system has not refreshed its list of event sources, and you attempt to write an event with the new source, the write operation will fail.

excerpted from: http://msdn.microsoft.com/en-us/library/k2976wx2.aspx

That is not the issue as it is writing but to the wrong log, as in system not application. If I use the source name "Fred" or anything else it goes to the application log. It is windows trying to be "clever" I think, but I am sure I have seen "Save Dump" as a source name in the application event log.

I haven't run into this problem. Have you checked to ensure there is no exception being thrown? I was about to shutdown my browser and thought I would pass on this similar blog I found related to deployment, which may or may not help you:

App writing to system log...

This article has been dead for over six months. Start a new discussion instead.