We have creates a webpart and in the catch block we are writing logs to uls.
My concern is regarding permission to write to this log. Will users with read-only access to sharepoint face no issue?
private void WriteToULS(TraceSeverity Level, string OutStr)
{
SPDiagnosticsService.Local.WriteTrace(0, new SPDiagnosticsCategory("Portal Error", Level, EventSeverity.Error), TraceSeverity.Unexpected, OutStr, null);
}
I would also like to know if it a good practice to use:
private void WriteToULS(TraceSeverity Level, string OutStr)
{
SPSecurity.RunWithElevatedPrivileges(delegate()
{
SPDiagnosticsService.Local.WriteTrace(0, new SPDiagnosticsCategory("Portal Error", Level, EventSeverity.Error), TraceSeverity.Unexpected, OutStr, null);
});
}
in the code for all webparts.