SPDiagnosticsService.LogLocation 属性
获取或设置文件系统目录,在其中创建日志文件的路径。
命名空间: Microsoft.SharePoint.Administration
程序集: Microsoft.SharePoint(位于 Microsoft.SharePoint.dll 中)
语法
声明
Public Property LogLocation As String
Get
Set
用法
Dim instance As SPDiagnosticsService
Dim value As String
value = instance.LogLocation
instance.LogLocation = value
public string LogLocation { get; set; }
属性值
类型:System.String
一个有效的文件系统路径与String 。
备注
您指定的位置必须在服务器场中所有服务器上的有效位置。日志文件的默认位置是
%CommonProgramFiles%\Microsoft Shared\Web Server Extensions\14\Logs
示例
下面的示例是一个控制台应用程序将打印到控制台日志文件的当前位置。
using System;
using Microsoft.SharePoint.Administration;
namespace Test
{
class Program
{
static void Main(string[] args)
{
SPDiagnosticsService diagSvc = SPDiagnosticsService.Local;
string ulsLogLocation = diagSvc.LogLocation;
Console.WriteLine(ulsLogLocation);
Console.Write("\nPress ENTER to continue...");
Console.ReadLine();
}
}
}
Imports System
Imports Microsoft.SharePoint.Administration
Namespace Test
Friend Class Program
Shared Sub Main(ByVal args() As String)
Dim diagSvc As SPDiagnosticsService = SPDiagnosticsService.Local
Dim ulsLogLocation As String = diagSvc.LogLocation
Console.WriteLine(ulsLogLocation)
Console.Write(vbLf & "Press ENTER to continue...")
Console.ReadLine()
End Sub
End Class
End Namespace