Share via


SPDiagnosticsService.ResetItem method (IDiagnosticsLevel)

NOTE: This API is now obsolete.

Resets the default reporting thresholds for a category that is specified by an IDiagnosticsLevel object.

Namespace:  Microsoft.SharePoint.Administration
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)

Syntax

'Declaration
<ObsoleteAttribute("directly modify severities on SPDiagnosticsCategory")> _
Public Sub ResetItem ( _
    item As IDiagnosticsLevel _
)
'Usage
Dim instance As SPDiagnosticsService
Dim item As IDiagnosticsLevel

instance.ResetItem(item)
[ObsoleteAttribute("directly modify severities on SPDiagnosticsCategory")]
public void ResetItem(
    IDiagnosticsLevel item
)

Parameters

Implements

IDiagnosticsManager.ResetItem(IDiagnosticsLevel)

Examples

The following example shows a console application that resets the default reporting thresholds for the Unified Logging Service category.

Imports System
Imports Microsoft.SharePoint
Imports Microsoft.SharePoint.Administration

Module ConsoleApp

   Sub Main()

      Dim diagnostics As SPDiagnosticsService = SPDiagnosticsService.Local
      If Not diagnostics Is Nothing Then
         Dim category As IDiagnosticsLevel = diagnostics.GetItem("Unified Logging Service")
         If Not category Is Nothing Then
            diagnostics.ResetItem(category)
            diagnostics.Update()
         End If
      End If

      Console.Write(vbCrLf + "Press ENTER to continue...")
      Console.ReadLine()
   End Sub

End Module
using System;
using Microsoft.SharePoint;
using Microsoft.SharePoint.Administration;

namespace Test
{
   class ConsoleApp
   {
      static void Main(string[] args)
      {
         SPDiagnosticsService diagnostics = SPDiagnosticsService.Local;
         if (diagnostics != null)
         {
            IDiagnosticsLevel category = diagnostics.GetItem("Unified Logging Service");
            if (category != null)
            {
               diagnostics.ResetItem(category);
               diagnostics.Update();
            }
         }
         Console.Write("\nPress ENTER to continue...");
         Console.ReadLine();
      }
   }
}

See also

Reference

SPDiagnosticsService class

SPDiagnosticsService members

ResetItem overload

Microsoft.SharePoint.Administration namespace

SetItem(IDiagnosticsLevel, TraceSeverity, EventSeverity)