How to: Select a Custom Event Source Name - Not working

Jun 10, 2010 at 7:17 AM

I am using LogToOperations method provided by SGL for logging.
My requrement was that the event should be logged under custom event source.
I have used following code to set the custome event source name for SGL Logger as suggested in the link for SGL
First I created the "My Custom Event Source" evenet source

string eventSourceKey =

serviceLocator = SharePointServiceLocator.GetCurrentFarm();
configManager = serviceLocator.GetInstance<IConfigManager>();

IPropertyBag propertyBag = configManager.GetPropertyBag(ConfigLevel.CurrentSPFarm);

configManager.SetInPropertyBageventSourceKey , "My Custom Event Source", propertyBag);

But evenet was created in the eventViewer but the source was "Patterns and Practices".

I changed the eventSourceKey to 
 Microsoft.Practices.SPG.Common.EventSourceName as mentioned in the link
But that also didnot work.
So its a bug or what?

So what excately has to be done to use Custom Evenet Source Name for LogToOperations methods.

Jun 10, 2010 at 1:49 PM

Hi Manish,

It looks like you are referring to the version of guidance for the last release, but using the 2010 drop on codeplex.  The logging area has changed, and you should refer to the guidance that is part of the drop package for for how to configure this.  Logging is configured using DiagnosticsAreaCollection.  Also you should make sure that the event sources are created on each WFE.  THere is a helper class for that called DiagnosticsAreaEventSource, but you will need to run a console app or a script that calls this to create them.