1

In my VB.NET application, I created a new Event Log Name named "My_Log", and I have this application run for a number of different situations where each situation is named by a unique name, and on logging, I create new Event Sources with these unique name on my new log using the function:

EventLog.CreateEventSource("My_1st_Source, "My_Log")

Now, all my logs are written in my log but 3 or 4 of them! they're written on "Application" Log.

I tried using EventLog.LogNameFromSourceName("My_1st_Source", Environment.MachineName)on all my situations (with all different event sources' names) to see that they are under my log "My_Log", and they all gave me the same result that they are under my log name; but some of them are still appearing in "Application" Log.

Why is that happening? and is there any way to get all my logs under my log name? Thanks.

Anas Mousa
  • 23
  • 1
  • 5

1 Answers1

1

You might want to try restarting your computer if you have ever mapped these sources to the Application log. According to http://msdn.microsoft.com/en-us/library/2awhba7a.aspx,

If a source has already been mapped to a log and you remap it to a new log, you must restart the computer for the changes to take effect.

Ryan M
  • 2,072
  • 11
  • 14
  • Thanks for your answer:) I made a restart for my computer but it didn't change anything, so is there any other thing to do?? – Anas Mousa May 20 '13 at 19:49
  • Not sure -- http://stackoverflow.com/questions/1901312/eventlog-createeventsource-is-not-creating-a-custom-log might be helpful. – Ryan M May 20 '13 at 20:22
  • I saw it, things there are already implemented in my code, anyway, we didn't run the process on our live servers; we only saw these cases while testing, so let's hope that restart will solve it... Thanks for your efforts again :) – Anas Mousa May 21 '13 at 10:49