Need an way to specify the Event Source Nameto the ILogger

Sep 15, 2009 at 12:44 PM

If multiple applications reside on the same farm, there is no reason why they should all be using the same event source.  I know this was a raging debate for years on Windows logging. Event Sources vs. Logs.

Since there is really not an option for a separate log for each Sharepoint-based application, event source differentiation would be nice. Since is the interface for named instances of services, each named instance should be ableo to select from a hiearchical config property which event source name it needed to use.

 

 

Sep 15, 2009 at 12:57 PM

Never mind.... found it in the source, if there is a Sharepoint Context, then it will take the key from the SPWeb.

 

if (SPContext.Current == null)
            {
                // There is no SharePoint context: Get the config from the farm.
                if (config.ContainsKey(Constants.EventSourceNameConfigKey, ConfigLevel.CurrentSPFarm))
                {
                    eventSource = config.GetByKey<string>(Constants.EventSourceNameConfigKey, ConfigLevel.CurrentSPFarm);
                }
            }
            else
            {
                // There is a SharePoint context. Get the config from the current SPWeb
                if (config.ContainsKey(Constants.EventSourceNameConfigKey))
                {
                    eventSource = config.GetByKey<string>(Constants.EventSourceNameConfigKey);
                }
            }