Exemplo n.º 1
0
        private void PurgeOldLogEvents()
        {
            if (!WebConfigSettings.UseSystemLogInsteadOfFileLog)
            {
                return;
            }
            if (!WebConfigSettings.SystemLogDeleteOldEventsOnApplicationStart)
            {
                return;
            }

            try
            {
                DateTime cutoffDate = DateTime.UtcNow.AddDays(-WebConfigSettings.SystemLogApplicationStartDeleteOlderThanDays);

                SystemLog.DeleteOlderThan(cutoffDate);
            }
            catch (Exception ex)
            {
                log.Error(ex);
            }
        }