【发布时间】:2011-10-18 20:27:47
【问题描述】:
我的所有 log4net 附加程序都已在我的 Web 应用程序中设置并正常工作,但是当我启动不同的线程来启动数据同步过程时,该单独线程中的所有日志语句都进入了空的深渊;我的 appender 都没有被解雇。有人知道为什么会这样吗?
private static readonly ILog Log = LogManager.GetLogger("mylog");
public static string SomeValue
{
get
{
Log.Debug("This WILL be appended to the log");
var thread = new Thread(SyncData);
thread.Start();
return "the value";
}
}
private static void SyncData()
{
Log.Debug("This will NOT be appended to log");
var newLog = LogManager.GetLogger("mylog");
newLog.Debug("This will also NOT be appended to the log");
}
【问题讨论】:
标签: c# asp.net-mvc multithreading log4net