Ejemplo n.º 1
0
 public void WriteLog(Exception e)
 {
     try
     {
         string logType = e.GetType().FullName;
         Exception temp = e;
         string message = "";
         if (System.Web.HttpContext.Current != null && System.Web.HttpContext.Current.Request != null)
             message = "Path: " + System.Web.HttpContext.Current.Request.Path + "\r\n";
         string stackTrace = "";
         while (temp != null)
         {
             message += "* Exception : " + temp.Message + "\r\n";
             if (temp.StackTrace != null)
                 stackTrace += "* StackTrace : " + temp.StackTrace.ToString() + "\r\n";
             temp = temp.InnerException;
         }
         message = message + stackTrace;
         Write(message, logType);
     }
     catch
     {
         FileLogger logger = new FileLogger();
         logger.WriteLog(e);
     }
 }
Ejemplo n.º 2
0
 public void WriteLog(string message)
 {
     try
     {
         Write(message, "LOG");
     }
     catch
     {
         FileLogger logger = new FileLogger();
         logger.WriteLog(message);
     }
 }