Exemplo n.º 1
0
        public void StartLogging()
        {
            if (!Directory.Exists(SetupLoggerImpl.setupLogDirectory))
            {
                Directory.CreateDirectory(SetupLoggerImpl.setupLogDirectory);
            }
            string filename       = Path.Combine(SetupLoggerImpl.setupLogDirectory, SetupLoggerImpl.setupLogFileNameForWatson);
            string filename2      = Path.Combine(SetupLoggerImpl.setupLogDirectory, "ExchangeSetup.msilog");
            string dataMiningPath = null;

            if (DatacenterRegistry.IsMicrosoftHostedOnly())
            {
                string text = "d:\\ExchangeSetupLogs";
                if (!Directory.Exists(text))
                {
                    Directory.CreateDirectory(text);
                }
                dataMiningPath = Path.Combine(text, SetupLoggerImpl.setupLogFileName);
            }
            ExWatson.TryAddExtraFile(filename);
            ExWatson.TryAddExtraFile(filename2);
            try
            {
                TaskLogger.IsSetupLogging = true;
                TaskLogger.StartFileLogging(SetupLoggerImpl.setupLogFilePath, dataMiningPath);
                this.isLoggingStarted = true;
            }
            catch (IOException ex)
            {
                throw new SetupLogInitializeException(ex.Message, ex);
            }
            catch (UnauthorizedAccessException ex2)
            {
                throw new SetupLogInitializeException(ex2.Message, ex2);
            }
            this.Log(SetupLoggerImpl.AsterixLine);
            this.Log(Strings.SetupLogStarted);
            this.Log(SetupLoggerImpl.AsterixLine);
            this.Log(Strings.LocalTimeZone(TimeZoneInfo.Local.DisplayName));
            this.Log(Strings.OSVersion(Environment.OSVersion.ToString()));
            try
            {
                this.LogAssemblyVersion();
            }
            catch (FileVersionNotFoundException ex3)
            {
                throw new SetupLogInitializeException(ex3.Message, ex3);
            }
            this.LogUserName();
            this.TaskStartTime = DateTime.UtcNow;
        }