共用方式為


Using Windows Powershell Cmdlets with ULS Logging

Applies to: SharePoint Foundation 2010

Microsoft SharePoint Foundation 2010 provides the ability to use Windows PowerShell cmdlets to perform administrative tasks. This technology can also be used for manipulating Unified Logging Service (ULS) log settings.

Overview

ULS provides Windows PowerShell cmdlets for a number of operations, including:

  • Changing ULS configuration settings

  • Trace and Event Level throttling

  • Flushing current log and starting a new one

  • Querying and filtering Trace Logs

  • Merging Trace Logs from multiple machines

CmdLet Examples

Noun

Description

Purpose

Get-SPDiagnosticConfig

Retrieves Diagnostic Configuration values.

Diagnostic Configuration

Set-SPDiagnosticConfig

Allows setting Diagnostic Configuration values.

Diagnostic Configuration

Get-SPLogLevel

Returns IDiagnosticsLevel2 objects or displays a list of diagnostics levels.

Trace Log and Event Log Throttling

Set-SPLogLevel

Allows the user to set the trace and event level for a set of categories.

Trace Log and Event Log Throttling

Clear-SPLogLevel

Resets the trace and event levels back to their default values.

Trace Log and Event Log Throttling

New-SPLogFile

Ends the current log file and starts a new one.

Log File Control

Get-SPLogEvent

Reads/queries ULS trace logs.

Trace Log Querying and Filtering

Merge-SPLogFile

Combines trace log files from all farm servers into a single file.

Trace Log Merging

See Also

Concepts

Windows PowerShell in the SharePoint Management Shell