我在我的ASP.NET MVC3项目中使用log4net,但所有日志属性,如IsDebugEnabled== false
在我的AssemblyInfo中,我有:
[assembly: XmlConfigurator(Watch = true)]
Run Code Online (Sandbox Code Playgroud)
在我的日志课中,我有
public Log4NetLogger()
{
log4net.Config.XmlConfigurator.Configure();
Logger = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
}
Run Code Online (Sandbox Code Playgroud)
我在Web.Config中的相关配置是:
<?xml version="1.0" encoding="utf-8"?>
<!--
For more information on how to configure your ASP.NET application, please visit
http://go.microsoft.com/fwlink/?LinkId=152368
-->
<configuration>
<configSections>
<sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" requirePermission="false"/>
</sectionGroup>
</configSections>
<log4net debug="false">
<appender name="AdoNetAppender" type="log4net.Appender.AdoNetAppender">
<bufferSize value="100" />
<connectionType value="System.Data.SqlClient.SqlConnection, System.Data, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<connectionString value="{removed}" />
<commandText value="INSERT INTO Logging ([Date],[Thread],[Level],[Logger],[Message],[Exception]) VALUES (@log_date, @thread, …Run Code Online (Sandbox Code Playgroud)