private static void UpdateConfigIfChanged(object state) { if (StxLogger.registryWatcher.IsChanged()) { using (RegistryKey registryKey = Registry.LocalMachine.OpenSubKey("SYSTEM\\CurrentControlSet\\Services\\Monitoring\\Parameters")) { StxLogger.Enabled = StxLogger.GetRegistryBool(registryKey, "ProtocolLoggingEnabled", true); } } }
private static void Initialize(StxLoggerBase stxLogger) { stxLogger.Initialized = true; int registryInt; using (RegistryKey registryKey = Registry.LocalMachine.OpenSubKey("SYSTEM\\CurrentControlSet\\Services\\Monitoring\\Parameters")) { StxLogger.Enabled = StxLogger.GetRegistryBool(registryKey, "ProtocolLoggingEnabled", true); registryInt = StxLogger.GetRegistryInt(registryKey, "LogBufferSize", 256); } if (StxLogger.registryWatcher == null) { StxLogger.registryWatcher = new RegistryWatcher("SYSTEM\\CurrentControlSet\\Services\\Monitoring\\Parameters", false); } if (StxLogger.timer == null) { StxLogger.timer = new Timer(new TimerCallback(StxLogger.UpdateConfigIfChanged), null, 0, 300000); } if (StxLogger.Enabled) { stxLogger.Log.Configure(Path.Combine(StxLogger.GetExchangeInstallPath(), "Logging\\MonitoringLogs\\STx"), StxLogger.defaultMaxRetentionPeriod, (long)StxLogger.defaultDirectorySizeQuota.ToBytes(), (long)StxLogger.defaultPerFileSizeQuota.ToBytes(), true, registryInt, StxLogger.defaultFlushInterval); AppDomain.CurrentDomain.ProcessExit += StxLogger.CurrentDomain_ProcessExit; } }