我像示例中一样设置了 log4net,但它仍然不起作用

I have log4net setup just like in the examples, but it still doesn't work

我像示例中一样设置了 log4net。在我的配置文件中,我有:

<configSections>
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" />
</configSections>

appender 配置的设置就像在 MS SQL 服务器的 log4net 站点上显示的那样,服务器被 <log4net> 包围。 http://logging.apache.org/log4net/release/config-examples.html

在 AssemblyInfo.cs 我有:

[assembly: log4net.Config.XmlConfigurator]

然而,我的 [dbo].[Log] table.

中没有显示任何内容

我试过使用跟踪调试文本文件,但没有出现错误。

跟踪文件中没有显示错误的原因是 log4net 中没有发生错误。

[dbo].[Log] table 中没有显示任何内容的原因是 l4n 站点上的默认配置有 <bufferSize value="100" />。据我了解,这个 bufferSize 意味着 l4n 会等到有 100 条消息排队,然后再将它们写入数据库。所以,为了帮我修复它,我只是将值更改为“1”。