【问题标题】:log4net not working using log4net appender azure in MVC applcationlog4net 在 MVC 应用程序中无法使用 log4net appender azure
【发布时间】:2015-07-19 08:48:31
【问题描述】:

同样的log4net appender azure nuget 代码在console app, but not working in MVC application 上运行良好。

我正在使用这个 nuget log4net.Appender.Azure 1.1.1

已在 Global.asax 中添加 log4net.Config.XmlConfigurator.Configure(); web.config

  <log4net>
    <!-- Azure Table Appender, uncomment, set proper QueueName and AWS credentials (appSettings) to try it out -->
    <appender name="AzureAppender1" type="log4net.Appender.AzureTableAppender, log4net.Appender.Azure">
      <param name="TableName" value="test" />
      <param name="ConnectionString" value="***" />
      <layout type="log4net.Layout.PatternLayout">
        <conversionPattern value="%date [%thread] %-5level %logger [%property{NDC}] - %message%newline" />
      </layout>
    </appender>

谁能知道它为什么不工作?

【问题讨论】:

    标签: asp.net-mvc azure log4net azure-storage log4net-appender


    【解决方案1】:

    我不确定 - 但对于将表用于大规模日志记录场景,我会有点小心。看看Table Design Guide 中的日志记录反模式。它通常会导致热分区 - 通常情况下,使用 Blob 可以更好地支持该场景。

    【讨论】:

      【解决方案2】:

      在这里,我发现它是 log4net dll 版本的问题。 在 nuget log4net appender azure 版本的 log4net dll 中是 1.2.12 它是较旧的版本。需要更新到更新版本1.2.13

      解决了上述问题。

      【讨论】:

      • 只需在包管理器控制台中运行 Update-Package log4net。
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-08-29
      • 2017-02-19
      • 2011-09-21
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多