示例#1
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);
     }
 }
示例#2
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;
            }
        }
示例#3
0
 internal static void BeginAppend(StxLoggerBase stxLogger, LogRowFormatter row)
 {
     StxLogger.AppendDelegate appendDelegate = new StxLogger.AppendDelegate(StxLogger.Append);
     appendDelegate.BeginInvoke(stxLogger, row, null, null);
 }