Provides a diagnostic logging category manager for Windows SharePoint Services.
Assembly: Microsoft.SharePoint (in Microsoft.SharePoint.dll)
<GuidAttribute("CB4D9DFD-60CF-4d6a-8615-F8A8448452CB")> _ <SharePointPermissionAttribute(SecurityAction.LinkDemand, ObjectModel := True)> _ <SharePointPermissionAttribute(SecurityAction.InheritanceDemand, ObjectModel := True)> _ Public Class SPDiagnosticsService _ Inherits SPService _ Implements IDiagnosticsManager Dim instance As SPDiagnosticsService
[GuidAttribute("CB4D9DFD-60CF-4d6a-8615-F8A8448452CB")] [SharePointPermissionAttribute(SecurityAction.LinkDemand, ObjectModel = true)] [SharePointPermissionAttribute(SecurityAction.InheritanceDemand, ObjectModel = true)] public class SPDiagnosticsService : SPService, IDiagnosticsManager
This class enables you to do programmatically what you can do manually through the user interface in the Trace Log and Event Throttling sections on the Central Administration Diagnostics Logging page.
Trace logs receive informative messages about the execution of an application that has been instrumented for tracing. Application tracing is often used to measure product performance and to diagnose errors. However, logs do grow over time, and they must be managed carefully to keep them from consuming too much disk space. To manage the location, size, and number of trace logs programmatically throughout the server farm, start by getting an instance of the SPDiagnosticsService class from the static Local property. Then set the object's LogLocation, LogCutInterval, and LogsToKeep properties. Finally, propagate the new configuration throughout the server farm by calling the Update() method.
Event throttling is a term that refers to controlling the rate at which events are captured in the Windows event log and in trace logs. Events are managed by categories, and separate reporting thresholds are maintained for each type of log. To set thresholds for a particular category, you must first get an instance of the SPDiagnosticsService class by accessing the static Local property. Then call the SetItem method, passing an instance of a class that implements the IDiagnosticsLevel interface to identify the category, a TraceSeverity value for the trace log threshold, and an EventSeverity value for the event log threshold. Alternatively, you can set thresholds for all categories at the same time by calling the SetAll method.
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.