Quantcast
Channel: SharePoint 2010 - Development and Programming forum
Viewing all articles
Browse latest Browse all 11571

Avoid Log to Event Viewer - SharePoint

$
0
0

Hi, 

I finished a SharePoint 2010 project, but some errors are logged at Windows Event Viewer. Howover, I want the error to be logged at ULS SharePoint log. 

If a use the bellow code, the error shows only at ULS SharePoint log and doesn't show at Windows Event Viewer, right? What do you think about?

try
{
    var i = 0;
    var a = 2 / i;
}
catch (Exception ex)
{
    SPDiagnosticsService.Local.WriteTrace(0, new SPDiagnosticsCategory("MyCategory", TraceSeverity.Unexpected, EventSeverity.Error),TraceSeverity.Unexpected, ex.Message, ex.StackTrace);

}

Thanks

Everton


Viewing all articles
Browse latest Browse all 11571

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>