using System; using System.Threading; using log4net; namespace logtest { class MainClass { public static void Main(string[] args) { Thread.CurrentThread.Name = "main"; log4net.Config.XmlConfigurator.Configure(); ILog log = LogManager.GetLogger(typeof(MainClass)); log.Info("Starting Test"); Thread thread1 = new Thread(Thread1); thread1.Name = "thread1"; Thread thread2 = new Thread(Thread2); thread2.Name = "thread2"; thread1.Start(); thread2.Start(); } private static void Thread1() { while(true) { Thread.Sleep(5000); ILog log = LogManager.GetLogger(typeof(MainClass)); log.Info("Thread1"); } } private static void Thread2() { while(true) { Thread.Sleep(5000); ILog log = LogManager.GetLogger(typeof(MainClass)); log.Info("Thread2"); } } } }