Example #1
0
        public static MemoryCacheQueue Instance()
        {
            if (_memoryCacheQueue == null)
            {
                _memoryCacheQueue = new MemoryCacheQueue();
            }

            return _memoryCacheQueue;
        }
Example #2
0
        public override void ActivateOptions()
        {
            InternalLogHelper.WriteLog("MemoryOptimizedAppender->ActivateOptions");

            MemoryCacheQueue.Instance().RemoteAddress = RemoteAddress;
            MemoryCacheQueue.Instance().ErrorHandler  = ErrorHandler;
            MemoryCacheQueue.Instance().Initialize();

            base.ActivateOptions();
            MemoryCacheQueue.Instance().StartDequeueWorkerThread(); /*Queue初始化完成后开始工作者线程*/
        }
Example #3
0
 protected override void OnClose()
 {
     try
     {
         base.OnClose();
         MemoryCacheQueue.Instance().DoClean();
     }
     catch (Exception ex)
     {
         LogLog.Error(typeof(MemoryOptimizedAppender), ex.ToString());
         InternalLogHelper.WriteLog(ex.ToString());
     }
 }
Example #4
0
 public override bool Flush(int millisecondsTimeout)
 {
     MemoryCacheQueue.Instance().Flush();
     return(base.Flush(millisecondsTimeout));
 }
Example #5
0
 protected override void Append(LoggingEvent loggingEvent)
 {
     MemoryCacheQueue.Instance().Enqueue(loggingEvent.RenderedMessage);
 }