/// <summary> /// Method to log only to the ULS /// </summary> /// <param name="eventId"></param> /// <param name="severity"></param> /// <param name="area"></param> /// <param name="category"></param> /// <param name="message"></param> public static void LogToULS(uint eventId, SPTraceLogger.TraceSeverity severity, string area, string category, string message) { try { SPSecurity.RunWithElevatedPrivileges(delegate() { using (SPTraceLogger traceLogger = new SPTraceLogger()) { traceLogger.Write(eventId, severity, area, category, message); } }); } catch (Exception e) { LogLoggerException(e.ToString()); } }
private static void LogEventToULS(string message) { try { SPSecurity.RunWithElevatedPrivileges(delegate() { using (SPTraceLogger traceLogger = new SPTraceLogger()) { traceLogger.Write(0, SPTraceLogger.TraceSeverity.InformationEvent, "Logger", "Application", message); } }); } catch (Exception e) { LogLoggerException(e.ToString()); }; }
private static void LogExceptionToULS(string exceptionMessage) { try { SPSecurity.RunWithElevatedPrivileges(delegate() { using (SPTraceLogger traceLogger = new SPTraceLogger()) { traceLogger.Write(0, SPTraceLogger.TraceSeverity.Exception, "Logger", "Exception", exceptionMessage); } }); } catch (Exception e) { LogLoggerException(e.ToString()); }; }