Set-SPLogLevel

设置一组类别的跟踪级别和事件级别。

语法

Set-SPLogLevel
   [-AssignmentCollection <SPAssignmentCollection>]
   [-EventSeverity <String>]
   [-Identity <String[]>]
   [-InputObject <PSObject>]
   [-TraceSeverity <String>]
   [<CommonParameters>]

说明

Set-SPLogLevel cmdlet 设置在场中注册的一个或多个诊断日志记录类别的 Windows 事件日志记录和跟踪日志记录级别。 如果出现与某类别关联的事件或跟踪,但其严重性低于该类别的日志记录级别,则事件或跟踪将不会写入到事件日志或跟踪日志中。 如果出现与某类别关联的事件或跟踪,且其严重性等于或高于该类别的日志记录级别,则事件或跟踪将会写入到事件日志或跟踪日志中。

有关适用于 SharePoint 产品的 Windows PowerShell 的权限和最新信息,请参阅 SharePoint Server cmdlet

示例

------------------示例 1-----------------------

set-sploglevel -TraceSeverity Monitorable

此示例将所有类别的 TraceSeverity 值设置为 Monitorable。

------------------示例 2-----------------------

Set-SPLogLevel -TraceSeverity High -EventSeverity Warning -Identity "Cat1"

此示例设置单个类别的 EventSeverity 和 TraceSeverity 值。

------------------示例 3-----------------------

"Cat1", "Cat2", "Cat3" | Set-SPLogLevel -EventSeverity Error

此示例设置多个类别的 EventSeverity 值。

------------------示例 4-----------------------

Set-SPLogLevel -EventSeverity Warning -Identity "AreaName:*"

此示例设置同一区域中所有类别的 EventSeverity 值。

参数

-EventSeverity

指定要设置的类别级别。 该类别级别为下列任意一个值:

  • ErrorCritical
  • 错误
  • Warning
  • 信息
  • Verbose
Type:String
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
Applies to:SharePoint Server Subscription Edition

-Identity

Specifies the name(s) of the category or set of categories to set the throttle for; for example, "Unified Logging Service". If the Identity parameter is not specified, the event-throttling setting is applied to all categories in the farm.

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

-InputObject

InputObject 会通过管道传输到该 cmdlet,它可以是格式与 Identity 参数相同的字符串,也可以是 SPDiagnosticsCategory 对象。 用户可以从 Get-SPLogLevel cmdlet 中检索一个或多个类别,修改类别值,然后将它们管道到 Set-SPLogLevel cmdlet 中。

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

-TraceSeverity

Specifies trace throttle to set the specified categor(ies) to. The trace log files are text files that are written to the trace log path that is defined on the Diagnostic Logging Settings page on the SharePoint Central Administration site. The type must be any one of the following values:

  • None (不向跟踪日志中写入任何跟踪)
  • Unexpected
  • Monitorable
  • High
  • Medium
  • Verbose
  • VerboseEx
Type:String
Position:Named
Default value:None
Accept pipeline input:False
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