【问题标题】:I have log4net setup just like in the examples, but it still doesn't work我有 log4net 设置,就像在示例中一样,但它仍然无法正常工作
【发布时间】:2015-05-08 22:38:48
【问题描述】:

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

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

appender 配置的设置就像它在 log4net 站点上显示的 MS SQL Server 一样,由&lt;log4net&gt; 包围。 http://logging.apache.org/log4net/release/config-examples.html

在 AssemblyInfo.cs 我有:

[assembly: log4net.Config.XmlConfigurator]

然而,我的[dbo].[Log] 表中没有显示任何内容。

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

【问题讨论】:

    标签: log4net log4net-configuration log4net-appender


    【解决方案1】:

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

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2022-08-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多