Share via


SPDiagnosticsService.LogLocation property

Gets or sets the path to the file system directory where log files are created.

Namespace:  Microsoft.SharePoint.Administration
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)

Syntax

'Declaration
Public Property LogLocation As String
    Get
    Set
'Usage
Dim instance As SPDiagnosticsService
Dim value As String

value = instance.LogLocation

instance.LogLocation = value
public string LogLocation { get; set; }

Property value

Type: System.String
A String with a valid file system path.

Remarks

The location that you specify must be a valid location on all servers in the server farm. The default location for log files is

%CommonProgramFiles%\Microsoft Shared\Web Server Extensions\14\Logs

Examples

The following example is a console application that prints the current location of log files to the console.

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

See also

Reference

SPDiagnosticsService class

SPDiagnosticsService members

Microsoft.SharePoint.Administration namespace