Why is there a Trace Severity in both the WriteTrace method of the SPDiagnosticsService and in the SPDiagnosticsCategory?
What I cannot understand is that when you use the WriteTrance, you have to supply the Severity and the category … so there would be 2 severities. why is that;
Why is there a Trace Severity in both the WriteTrace method of the SPDiagnosticsService
Share
The TraceSeverity in the SPDiagnosticsCategory is the severity that your log message must equal or exceed in order for the message to be written. This value can be controlled in Central admin, to control the level of details your logging writes.
The TraceSeverity in the SPDiagnosticsService.WriteTrace() method is how important that message is. If it equals or exceeds the TraceSeverity in the SPDiagnosticsCategory, the message is written.
Example:
severity. An entry is added to the logs.
written to the logs.
Thus, you can put calls to WriteTrace() in your code a differing levels of detail, and through central admin control the amount of information being written to your logs.
Also note that writing using SPDiagnosticsService.WriteEvent() can also write to the trace log too. I wrote a blog post about this you might find useful.