Пример #1
0
        private void CleanerTask()
        {
            try
            {
                // cleanup logs
                var logDeep = _settings.DayDeepLog;
                var logThreshold = _repository.GetLogThreshold(logDeep);
                if (logThreshold.HasValue)
                {
                    var count = _repository.CleanUpLog(logThreshold.Value);
                    _monik.LogicInfo("Cleaner delete Log: {0} rows", count);
                }

                // cleanup keep-alive
                var kaDeep = _settings.DayDeepKeepAlive;
                var kaThreshold = _repository.GetKeepAliveThreshold(kaDeep);
                if (kaThreshold.HasValue)
                {
                    var count = _repository.CleanUpKeepAlive(kaThreshold.Value);
                    _monik.LogicInfo("Cleaner delete KeepAlive: {0} rows", count);
                }
            }
            catch (Exception ex)
            {
                _monik.ApplicationError("CleanerTask: {0}", ex.Message);
            }
        }
Пример #2
0
        protected override void Write(LogEventInfo logEvent)
        {
            var message = Layout.Render(logEvent);

            if (logEvent.Level == LogLevel.Debug)
            {
                monikClient.ApplicationVerbose(message);
            }
            else if (logEvent.Level == LogLevel.Error)
            {
                monikClient.LogicError(message);
            }
            else if (logEvent.Level == LogLevel.Fatal)
            {
                monikClient.LogicFatal(message);
            }
            else if (logEvent.Level == LogLevel.Info)
            {
                monikClient.LogicInfo(message);
            }
            else if (logEvent.Level == LogLevel.Trace)
            {
                monikClient.LogicVerbose(message);
            }
            else if (logEvent.Level == LogLevel.Warn)
            {
                monikClient.LogicWarning(message);
            }
        }