Пример #1
0
 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);
         }
     }
 }
Пример #2
0
 internal static void Append(StxLoggerBase stxLogger, LogRowFormatter row)
 {
     lock (StxLogger.logLock)
     {
         if (!stxLogger.Initialized)
         {
             StxLogger.Initialize(stxLogger);
         }
     }
     if (StxLogger.Enabled)
     {
         stxLogger.Log.Append(row, stxLogger.DateTimeField);
     }
 }
Пример #3
0
        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;
            }
        }
Пример #4
0
 internal void BeginAppend(LogRowFormatter row)
 {
     StxLogger.BeginAppend(this, row);
 }
Пример #5
0
 private static void CurrentDomain_ProcessExit(object sender, EventArgs e)
 {
     StxLogger.Shutdown();
 }