//-------------------------------------------------------------------------------------------------// protected void Application_Start(object sender, EventArgs e) { const string STRLOG_MethodName = "Application_Start"; // // Set the filepath for the log files // string rootFilePath = HostingEnvironment.ApplicationPhysicalPath; string logFilesPath = Utilities.GetAppSetting(Library.LabEquipment.Engine.Consts.STRCFG_LogFilesPath); Logfile.SetFilePath(Path.Combine(rootFilePath, logFilesPath)); Logfile.Write(""); Logfile.WriteCalled(STRLOG_ClassName, STRLOG_MethodName); // // Create experiment manager and start it // allowedCallers = new AllowedCallers(); equipmentManager = new EquipmentManager(rootFilePath); equipmentManager.Create(); equipmentManager.Start(); Logfile.WriteCompleted(STRLOG_ClassName, STRLOG_MethodName); }
//-------------------------------------------------------------------------------------------------// protected void Application_Start(object sender, EventArgs e) { const String methodName = "Application_Start"; /* * Get the logfiles path */ String logFilesPath; try { logFilesPath = AppSetting.GetAppSetting(LabConsts.STRCFG_LogFilesPath); } catch (Exception ex) { Logfile.Write(ex.Message); throw new ApplicationException(String.Format(STRERR_NotSpecified_arg, LabConsts.STRCFG_LogFilesPath)); } if (logFilesPath == null) { throw new ApplicationException(String.Format(STRERR_NotSpecified_arg, LabConsts.STRCFG_LogFilesPath)); } /* * Set the filepath for the log files */ String rootFilePath = HostingEnvironment.ApplicationPhysicalPath; Logfile.SetFilePath(Path.Combine(rootFilePath, logFilesPath)); /* * Set the logging level */ try { String strLogLevel = AppSetting.GetAppSetting(LabConsts.STRCFG_LogLevel); Logfile.Level level = (Logfile.Level)Enum.Parse(typeof(Logfile.Level), strLogLevel, true); Logfile.SetLevel(level); } catch { Logfile.SetLevel(Logfile.Level.Info); } Logfile.Write(String.Empty); Logfile.WriteCalled(logLevel, STR_ClassName, methodName); /* * Get the equipment configuration filename */ String xmlEquipmentConfigFilename; try { xmlEquipmentConfigFilename = AppSetting.GetAppSetting(LabConsts.STRCFG_XmlEquipmentConfigFilename); } catch (Exception ex) { Logfile.Write(ex.Message); throw new ApplicationException(String.Format(STRERR_NotSpecified_arg, LabConsts.STRCFG_XmlEquipmentConfigFilename)); } if (xmlEquipmentConfigFilename == null) { throw new ApplicationException(String.Format(STRERR_NotSpecified_arg, LabConsts.STRCFG_XmlEquipmentConfigFilename)); } try { /* * Get configuration properties */ configProperties = new ConfigProperties(); configProperties.XmlEquipmentConfigPath = Path.Combine(rootFilePath, xmlEquipmentConfigFilename); /* * Create experiment manager and start it */ equipmentManager = new EquipmentManager(configProperties); if (equipmentManager.Create() == false) { throw new ApplicationException(STRERR_EquipmentManagerCreateFailed); } if (equipmentManager.Start() == false) { throw new ApplicationException(STRERR_EquipmentManagerStartFailed); } } catch (Exception ex) { this.Application_End(sender, e); throw ex; } Logfile.WriteCompleted(logLevel, STR_ClassName, methodName); }
//-------------------------------------------------------------------------------------------------// protected void Application_Start(object sender, EventArgs e) { const string STRLOG_MethodName = "Application_Start"; // // Set the filepath for the log files and the logging level // string rootFilePath = HostingEnvironment.ApplicationPhysicalPath; string logFilesPath = Utilities.GetAppSetting(Library.LabEquipment.Engine.Consts.STRCFG_LogFilesPath); Logfile.SetFilePath(Path.Combine(rootFilePath, logFilesPath)); // // Determine the logging level for this application // try { Logfile.LoggingLevels logLevel = (Logfile.LoggingLevels)Utilities.GetIntAppSetting(Library.LabEquipment.Engine.Consts.STRCFG_LoggingLevel); Logfile.SetLoggingLevel(logLevel); } catch { Logfile.SetLoggingLevel(Logfile.LoggingLevels.Minimum); } Logfile.Write(string.Empty); Logfile.WriteCalled(STRLOG_ClassName, STRLOG_MethodName); // // Create experiment manager and start it // allowedCallers = new AllowedCallers(); equipmentManager = new EquipmentManager(rootFilePath); equipmentManager.Create(); equipmentManager.Start(); Logfile.WriteCompleted(STRLOG_ClassName, STRLOG_MethodName); }