babgvant / elmah

Automatically exported from code.google.com/p/elmah
Apache License 2.0
0 stars 0 forks source link

Clear Log #104

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What new or enhanced feature are you proposing?
   public class SQLiteErrorLogX
   {
      public static int ClearLog() 
      {
         //HttpContext.Current.Trace.Write(MethodBase.GetCurrentMethod
().Name);

         ErrorLog errLogB = ErrorLog.GetDefault(HttpContext.Current);
         SQLiteErrorLog errLog = (SQLiteErrorLog)errLogB;
         const string ds = @"delete from Error";

         HttpContext.Current.Trace.Write("query=" + ds);

         using (SQLiteConnection connection = new SQLiteConnection
(errLog.ConnectionString))
         {
            using (SQLiteCommand command = new SQLiteCommand(ds, 
connection))
            {
               connection.Open();
               int rowsDeleted = command.ExecuteNonQuery();

               HttpContext.Current.Trace.Write("Error Log cleared. "+ 
rowsDeleted+ " entries were deleted.");
               return rowsDeleted;
            }
         }
         //using
      }
   }//class

Original issue reported on code.google.com by bradleym...@gmail.com on 24 May 2009 at 6:34

GoogleCodeExporter commented 9 years ago
ability to clear the error log.  Example is as the code above.

Original comment by bradleym...@gmail.com on 24 May 2009 at 6:41

GoogleCodeExporter commented 9 years ago
agreed, this is needed. I cannot find if this exists currently.

Original comment by schmi...@gmail.com on 14 Sep 2010 at 2:14

GoogleCodeExporter commented 9 years ago
I also wanted this but using MS SQL.

Original comment by nalz...@gmail.com on 9 Jun 2011 at 9:21

GoogleCodeExporter commented 9 years ago
Ability to configure how the data can be cleared - e.g. entries beyond a month 
or every time we do a fresh deployment. 

Original comment by kamdar.h...@gmail.com on 26 Feb 2013 at 8:13