4

I'm writing log with the method WriteTrace of SPDiagnosticsService. I'd like to know where i can see the log? in the eventviewer (windows/application), i don't see it.

Here is my function

public static void LogData(string categoryName, Level type, string section, string message, string exception)
    {
        try
        {
            /*Log SharePoint*/
            SPDiagnosticsService diagnosticsService = SPDiagnosticsService.Local;
            diagnosticsService.WriteTrace(0,
                                          new SPDiagnosticsCategory(categoryName, TraceSeverity.Unexpected,
                                                                    EventSeverity.Error),
                                          TraceSeverity.Unexpected, exception, exception);
        }
        catch
        {
            throw new Exception("ExceptionManager.LogData > Failed !");
        }
    }

Can you explain me how to write log and see them.

Thanks

1
  • whats meant by Level class? is it a enumerator? Mar 21 '16 at 11:57
6
  1. The above code will log the information in ULS logs .Search for the category name in ULS logs ,you will see the logs.

  2. If you are looking for the SharePoint 2010 ULS Logs, you can find them here:

    C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\Logs

  3. Install the ULSViewer ,this will make your life more easy to read the logs. http://ulsviewer.codeplex.com/

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.