On an ASP NET project (C#) I'm using the System.Diagnostics namespace to log errors, warning and information. Using Windows 7 I see that the log I've set for the project is under "Applications and Services Logs". How can I set in code to create a folder and put it under "Applications and Services Logs[SOME FOLDER]\Applications and Services Logs", for examples?
When creating your Event Source
, specify a Log Name
. It will become the "folder" in the Event Viewer.
EventLog.CreateEventSource("Source", "Log name");
EventLog.WriteMessage("Source", "Your message");
Be aware that creating an event source may require additional rights on the machine. In an ASP.Net context, I suggest to create a windows or console application that create the Event Source. Run it once as an administrator.