Revision: 48166
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at June 25, 2011 07:59 by nickaranz
Initial Code
public class LoggingService : SPDiagnosticsServiceBase { public static string MaventionDiagnosticAreaName = "Truck Seach"; private static LoggingService _Current; public static LoggingService Current { get { if (_Current == null) { _Current = new LoggingService(); } return _Current; } } private LoggingService() : base("My Solution Logging Service", SPFarm.Local) { } protected override IEnumerable<SPDiagnosticsArea> ProvideAreas() { var areas = new List<SPDiagnosticsArea> { new SPDiagnosticsArea(MaventionDiagnosticAreaName, new List<SPDiagnosticsCategory> { new SPDiagnosticsCategory("Truck Search Copy Pictures", TraceSeverity.Verbose, EventSeverity.Information) }) }; return areas; } public static void LogError(string categoryName, string Message) { SPDiagnosticsCategory category = LoggingService.Current.Areas[MaventionDiagnosticAreaName].Categories[categoryName]; LoggingService.Current.WriteTrace(0, category, TraceSeverity.Verbose, Message); } }
Initial URL
Initial Description
Modify as neccesary, add more areas.
Initial Title
SharePoint 2010 Write to ULS logger
Initial Tags
Development, sharepoint
Initial Language
C#