public static void Stop() { StopManage(); // 关闭维护期 if (logShrink != null) { logShrink.Stop(); logShrink = null; } // 关闭记录者 if (logRecorder != null) { logRecorder.Stop(); logRecorder = null; } //关闭日志发布者 if (logPublisher != null) { logPublisher.Stop(); logPublisher = null; } IsRuning = false; }
public static void Start(ConfLogServiceInfo confLogServiceInfo, out string errMsg) { errMsg = ""; config = confLogServiceInfo; if (IsRuning) { return; } // 加载日志环境所需的配置文件信息 if (!CheckConfig(config, out errMsg)) { return; } // 打开日志发布者 logPublisher = new LogPublisher(config); logPublisher.Start(out errMsg); if (!logPublisher.IsRuning) { Stop(); return; } // 打开日志记录者 logRecorder = new LogRecorder(fileFullPath, logTableName); logRecorder.Start(); if (!logRecorder.IsRuning) { Stop(); return; } // 打开日志收缩器 logShrink = new LogShrink(fileFullPath, logTableName, config.ManintainTime, config.LogMaxSaveDays); logShrink.Start(); if (!logShrink.IsRuning) { Stop(); return; } // 打开日志管理者 StartMannge(); if (!ManageIsRuning) { Stop(); return; } IsRuning = true; }