ram*_*ram 19 logging log4net web-config configsection
我正在使用log4net进行日志记录.我的日志配置存储在单独的文件中.
Web.Config中:ConfigSections
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net" />
Run Code Online (Sandbox Code Playgroud)
在AssemblyInfo.cs中指定我的配置文件
[assembly: log4net.Config.XmlConfigurator(ConfigFile="Log4Net.config", Watch = true)]
Run Code Online (Sandbox Code Playgroud)
当我初始化我的LogManager时,我收到此错误
"System.TypeLoadException"
message: Could not load type 'log4net.Config.Log4NetConfigurationSectionHlandler' from assembly 'Log4net'.
Run Code Online (Sandbox Code Playgroud)
是的它说"Log4NetConfigurationSectionHlandler",它不是一个错字
后来,这个错误
An error occurred creating the configuration section handler for log4net: Could not load type 'log4net.Config.Log4NetConfigurationSectionHlandler' from assembly 'Log4net'.
Run Code Online (Sandbox Code Playgroud)
编辑:试过Mauricio Scheffer的建议
拿到
log4net:ERROR XmlConfigurator: Failed to find configuration section 'log4net' in the application's .config file. Check your .config file for the <log4net> and <configSections> elements. The configuration section should look like: <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net" />
Run Code Online (Sandbox Code Playgroud)
Mau*_*fer 26
如果您将配置放在单独的log4net.config文件中,则不需要sectionHandler.去掉它.
您也可能在代码中的某处调用XmlConfigurator.Configure().删除它.
另见这个问题
| 归档时间: |
|
| 查看次数: |
23464 次 |
| 最近记录: |