Clear-SPLogLevel

将 Windows 事件日志记录和跟踪日志记录重置为其默认值。

语法

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

说明

The Clear-SPLogLevel cmdlet resets the Windows event logging and trace logging levels for the specified categories to the default values. If the Identity parameter is not provided, all categories are affected.

有关适用于 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 区域中特定类别的日志级别。 当多个区域使用相同的命名类别时,这很有用。

参数

-Identity

指定要为其设置限制的类别或类别集的名称;例如,“统一日志记录服务”。 如果未指定 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

-工作分配

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