Clear-SPLogLevel

將 Windows 事件記錄和追蹤記錄重設為其預設值。

Syntax

Clear-SPLogLevel
     [-AssignmentCollection <SPAssignmentCollection>]
     [-Identity <String[]>]
     [-InputObject <PSObject>]
     [<CommonParameters>]

Description

Clear-SPLogLevel Cmdlet 會將指定類別的 Windows 事件記錄和追蹤記錄層級重設為預設值。 如果未提供 Identity 參數,則會影響所有類別。

如需適用於 SharePoint 產品的 Windows PowerShell 權限及最新資訊,請參閱線上文件 SharePoint Server Cmdlet

範例

--------------範例 1-----------------

Clear-SPLogLevel -Identity Cat1

此範例會重設單一類別目錄的記錄層級。

--------------範例 2-----------------

"Cat1", "Cat2", "Cat3" | Clear-SPLogLevel

此範例會重設多個類別的記錄層級。

--------------範例 3-----------------

Get-SPLogLevel | Clear-SPLogLevel

此範例會重設所有類別的記錄等級。

--------------範例 4-----------------

Clear-SPLogLevel -Identity "SharePoint Server:Database"

此範例只會重設 SharePoint Server 區域中特定類別的記錄層級。 當多個區域使用相同的具名類別時,這會很有用。

參數

-AssignmentCollection

Manages objects for the purpose of proper disposal. Use of objects, such as SPWeb or SPSite, can use large amounts of memory and use of these objects in Windows PowerShell scripts requires proper memory management. Using the SPAssignment object, you can assign objects to a variable and dispose of the objects after they are needed to free up memory. When SPWeb, SPSite, or SPSiteAdministration objects are used, the objects are automatically disposed of if an assignment collection or the Global parameter is not used.

When the Global parameter is used, all objects are contained in the global store. If objects are not immediately used, or disposed of by using the Stop-SPAssignment command, an out-of-memory scenario can occur.

Type:SPAssignmentCollection
Position:Named
Default value:None
Accept pipeline input:True
Accept wildcard characters:False
Applies to:SharePoint Server Subscription Edition

-Identity

指定要設定節流的類別或類別集 () 名稱;例如,「Unified Logging Service」。 若不指定 Identity 參數,伺服器陣列中的所有類別都會套用事件節流設定。

提供無效的類別是非終止錯誤,會予以略過。

Type:String[]
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
Applies to:SharePoint Server Subscription Edition

-InputObject

Specifies the result of the InputObject parameter to be piped. The value can be a string in a format identical to the Identity parameter, or can be an SPDiagnosticsCategory object. The user can retrieve one or more categories from the Get-SPLogLevel cmdlet, modify their values, and then pipe the results to the Set-SPLogLevel cmdlet.

Type:PSObject
Position:Named
Default value:None
Accept pipeline input:True
Accept wildcard characters:False
Applies to:SharePoint Server Subscription Edition