Appcelerator.Logger.setupLogFile C# (CSharp) Method

setupLogFile() private static method

private static setupLogFile ( ) : void
return void
        private static void setupLogFile()
        {
            try
            {
                //APPSDK-403: Read the logging settings from the ConfigurationManager (which reads them from web.config)
                String logFileLocation = ConfigurationManager.AppSettings["LogLocation"];
                String logLevelSetting = ConfigurationManager.AppSettings["LogLevel"];
                String autoFlushSetting = ConfigurationManager.AppSettings["AutoFlushLog"];

                //Set append to true so we automatically create a new file when needed but append otherwise
                writer = new StreamWriter(logFileLocation, true);

                bool autoflush = false;
                try
                {
                    autoflush = Boolean.Parse(autoFlushSetting);
                }
                catch { autoflush = false; }
                writer.AutoFlush = autoflush;

                try
                {
                    Logger.Instance.LoggingLevel = StringToLoggingLevel(logLevelSetting);
                }
                catch { Logger.Instance.LoggingLevel = LoggingLevel.OFF; }
            }
            catch
            {
                //If we can't open the settings file
                Logger.Instance.LoggingLevel = LoggingLevel.OFF;
                writer.AutoFlush = true;
            }
        }