protected virtual void SetupLogging() { TraceSource trace = Log.Trace(Name); trace.Switch.Level = SourceLevels.All; string logFilePath = string.Format("Logs\\{0}.{1}.log", Environment.MachineName, Name); DailyTextWriterListener dailyListener = new DailyTextWriterListener(logFilePath); trace.Listeners.Add(dailyListener); }
static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); TraceSource trace = XyratexOSC.Logging.Log.Trace(); trace.Switch.Level = SourceLevels.All; string logFileDirectory = "C:\\Seagate\\HGA.HST\\Log\\"; string logFilePath = string.Format("{0}{1}.BenchTestsTool.log", logFileDirectory, Environment.MachineName); if (!Directory.Exists(logFileDirectory)) { Directory.CreateDirectory(logFilePath); } DailyTextWriterListener dailyListener = new DailyTextWriterListener(logFilePath); trace.Listeners.Add(dailyListener); Application.Run(new frmMain()); }
public override void Startup() { try { _workcell = new HSTWorkcell(); TraceSource trace = Log.Trace(); trace.Switch.Level = SourceLevels.All; string logName = string.Format("{0}\\{1}.HST.log", HSTMachine.Workcell.HSTSettings.Directory.LogFilePath, HSTMachine.Workcell.HSTSettings.Install.EquipmentID /*Environment.MachineName*/); DailyTextWriterListener listener = new DailyTextWriterListener(logName); trace.Listeners.Add(listener); LogStartup(); RegisterWorkcell(HSTMachine.Workcell); HSTMachine.Workcell.instantiateWorkOrder(); ServiceManager.Tracing.Trace("Loaded Workcell: " + HSTMachine.Workcell.SlotName); } catch (Exception ex) { string msg = ServiceManager.ErrorHandler.GetExceptionMessages(ex); Notify.PopUpError("Startup error", "Failed to load module: " + HSTMachine.Workcell.SlotName + "\nError: " + msg + "\r\n\r\n" + ex); } base.Startup(); }