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)

public string LogLocation { get; set; }

Property value

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

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

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.Write("\nPress ENTER to continue...");