In my previous Blog “Writing Event Logs for SharePoint 2010 Projectsin C#”, we looked at creating Event Logs using C# for SharePoint 2010. In order to use the event logs in specific “Source” first we need to create a source. It could be done using the code but I think it would be an added overhead to check for the source every time a log is written. Moreover, it would turn out to be a nightmare if you end up having security exceptions while creating the event source through the code :S You can easily create a source using the PowerShell Command as given below:
Here you go, it is that simple …. This simple creates an event source with the name “MySource” under “Application” Log. Or you could also end up adding a new custom log by having “MyProject” instead of “Application” in the method above.
And of course don’t forget to run the power shell as Administrator ;)