log4net在MVC applcation中使用log4net appender azure无法正常工作

时间:2015-05-08 12:22:35

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

相同的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>
  

任何人都可以知道它为什么不起作用吗?

2 个答案:

答案 0 :(得分:3)

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

答案 1 :(得分:1)

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

解决了上述问题。