Configure SharePoint Logs From Code

11 Jul

If you want to configure SharePoint via code you can use the methods available in the Microsoft.SharePoint.Administration namespace.

For example, to configure the Usage Logs:

                SPUsageSettings usageSettings = SPWebService.AdministrationService.UsageSettings;<br /><br />                usageSettings.LoggingEnabled = <span class="kwrd">true</span>;<br />                usageSettings.NumberLogFiles = 5;<br />                usageSettings.LogFilesDirectory = &quot;c:\logs&quot;;<br />                usageSettings.UsageProcessingEnabled = <span class="kwrd">true</span>;<br /><br />                usageSettings.SetProcessingInterval(1, 0, 1, 0);<br /><br />                usageSettings.Update(<span class="kwrd">false</span>);
Tweet about this on TwitterShare on Google+Share on FacebookShare on RedditEmail this to someoneShare on LinkedInShare on StumbleUpon

Leave a Reply

Your email address will not be published. Required fields are marked *