我有以下代码:
public Log4NetLogger()
: base(LogLevel.Debug)
{
if(!LogManager.GetRepository().Configured)
{
lock(mLocker)
{
if(!LogManager.GetRepository().Configured)
{
XmlConfigurator.Configure();
}
}
}
mLog4NetInstance = LogManager.GetLogger(typeof(Log4NetLogger));
}
使用以下 web.config:
<log4net>
<appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender">
<file value="Logs\MaMLog_" />
<appendToFile value="true" />
<StaticLogFileAppName value="false" />
<rollingStyle value="Date" />
<datePattern value="yyyyMMMdd_dddd'.log'" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date{dd MMM yyyy HH:mm:ss,fff} [%thread] -() %message%newline" />
</layout>
<lockingModel type="log4net.Appender.FileAppender+MinimalLock" />
</appender>
<logger name="MyLog1">
<level value="Debug" />
<appender-ref ref="RollingLogFileAppender" />
</logger>
<logger name="MyLog2">
<level value="Debug" />
<appender-ref ref="RollingLogFileAppender" />
</logger>
</log4net>
代码如何知道记录器名称?如果有的话?