public static void MyClassInitialize(TestContext testContext) { string logSettingName = Assembly.GetExecutingAssembly().Location; logSettingName = Path.GetDirectoryName(logSettingName) + @"\log4net.Setting.xml"; LogInit.InitLog(logSettingName); AppenderListener.EventLogListen += LogListener; }
public static void MyClassInitialize(TestContext testContext) { string logSettingName = Assembly.GetExecutingAssembly().Location; logSettingName = Path.GetDirectoryName(logSettingName) + @"\log4net.Setting.xml"; LogInit.InitLog(logSettingName); AgentSetting.InitialSetting(); }
public void InitLogTest() { string logSettingName = Assembly.GetExecutingAssembly().Location; logSettingName = Path.GetDirectoryName(logSettingName) + @"\log4net.Setting.xml"; LogInit.InitLog(logSettingName); AppenderListener.EventLogListen += LogListener; string className = "abcde"; int taskId = 12345; string message = "a message"; worked = false; LogHelper.GetLoggerHandle().Debug(className, taskId, message); Thread.Sleep(200); Assert.AreEqual(worked, true); AppenderListener.EventLogListen -= LogListener; }
/// <summary> /// The on start. /// </summary> /// <param name="args"> /// The args. /// </param> protected override void OnStart(string[] args) { string logSettingName = System.Reflection.Assembly.GetExecutingAssembly().Location; logSettingName = System.IO.Path.GetDirectoryName(logSettingName) + @"\log4net.Setting.xml"; LogInit.InitLog(logSettingName); var taskManager = this.container.Resolve <ITaskManager>(); ((TaskManager)taskManager).Mode = (RequestTaskMode) Enum.Parse(typeof(RequestTaskMode), ConfigurationManager.AppSettings["RequestTaskMode"]); ((TaskManager)taskManager).InitializeTask(); var invoker = new Invoker((TaskManager)taskManager); invoker.MaxInterval = new TimeSpan( int.Parse(ConfigurationManager.AppSettings["MaxInvokerInterval"]) * TimeSpan.TicksPerSecond); invoker.Start(); }