kamagra how much to take

Getting SharePoint ULS Log Location Without Reverting To Literals

The ULS logs are pretty great, especially when you have pre-existing, non-development dependent errors occurring that make absolutely freakin no sense. It’s pretty easy to get the path using the SPDiagnosticsService object.

  1. public string ULSPath()
  2. {
  3. try
  4. {
  5. return SPDiagnosticsService.Local.LogLocation;
  6. }
  7. catch (SqlException sqlEx)
  8. {
  9. SPDiagCommonHelper.TraceException(sqlEx);
  10. }
  11. catch (SPException spEx)
  12. {
  13. SPDiagCommonHelper.TraceException(spEx);
  14. }
  15. return string.Empty;
  16. }
Share

2 Comments

  1. Vishnu says:

    A good idea when building logging tools for mixed 32bit and 64bit SharePoint farms.

  2. JB says:

    Great article!

    Here you find another nice article about logging with SharePoint:
    http://www.parago.de/2011/01/how-to-implement-a-custom-sharepoint-2010-logging-service-for-uls-and-windows-event-log/

Leave a Reply

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

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>