예제 #1
0
        private void removeLog()
        {
            Log.Program.Debug("removeLog()");
            Log.Program.Info("Suppression des fichiers de log de plus de " + Properties.Settings.Default.ResetLogDays + " jours");
            DateTime           date = DateTime.Now.AddDays(-Properties.Settings.Default.ResetLogDays);
            LogFileCleanupTask task = new LogFileCleanupTask();

            task.CleanUp(date);
            Log.Program.Info("Fin de la suppression des logs");
        }
예제 #2
0
 private static void ClearOldLogs()
 {
     try
     {
         // Cleanup logs older than 5 days from http://stackoverflow.com/a/2916628/1067721
         var date = DateTime.Now.AddDays(-5);
         var task = new LogFileCleanupTask();
         task.CleanUp(date);
         // Cleanup service logs
         task.CleanUp("daas_assessment_tool.log", date);
     }
     catch (Exception) { }
 }