Exemplo n.º 1
0
        /// <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());
            }
        }
Exemplo n.º 2
0
 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());
     };
 }
Exemplo n.º 3
0
 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());
     };
 }