Search code examples
c#.netasp.net-mvc-3event-logevent-viewer

Customize text in Source column of the Event Viewer (EventLog)


Is it possible to write to the Source column in the Event Viewer my wanted source ?

(instead of ".NET Runtime" ?)

And if so, how?


Solution

  • I searched in start menu for "run", opened it, in the text field I wrote "regedit" and pressed "OK".

    Now,I got into "eventlog" folder, right clicked on the "Application" folder, chose New => Key, then named it like my project name (what will actually be shown in Source column in the Event Viewer).

    Then simply write in the code : logName.Source = "MySource";

    Now it will work in the localhost only. If you want it to wark in the server too - just open "run" again in the server the same as you did in the first time, but now it will not open directly what we need, so you have to track the same folders that contain the "Application" folder (you will find it exsactly at the same location like in the local computer), and add your sourse in the same way.

    Good Luck !