log4net not appending to azure blob

Asked by At

I want to append logs to azure blob storage. So i added nuget package called log4net.appender.azure.

Wrote following in app.config


  <level value="ALL" />
  <appender-ref ref="AzureBlobAppender" />


<appender name="AzureBlobAppender" type="log4net.Appender.AzureBlobAppender, log4net.Appender.Azure">
  <param name="ContainerName" value="myConatiner"/>
  <param name="DirectoryName" value="myFolder/logs.txt"/>

  <param name="ConnectionString" value="DefaultEndpointsProtocol=https;AccountName=XXXX;AccountKey=Ngqa/KvLxL4zpxdPDv8Opm29JCOXTJuJsF8FrzFQZpWCOcoFm1EI+mvFu+7AJvaWEU3jDffYrf4rGOKPJu/ObA==;EndpointSuffix=core.windows.net" />
  <param name="AsText" value="true" />

this is how i defined connection string

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

then i wrote below in class file

 log4net.ILog log =
    log.Info("I am being tested");

but when i run program i dont see anything logged in azure blob. What am i missing?

1 Answers

Daniel Schilling On

Looks to me like your configuration is wrong. According to the examples in the README...

<appender name="AzureBlobAppender" type="log4net.Appender.AzureBlobAppender, log4net.Appender.Azure">
  <param name="ContainerName" value="testloggingblob"/>
  <param name="DirectoryName" value="logs"/>
  <!-- You can either specify a connection string or use the ConnectionStringName property instead -->
  <param name="ConnectionString" value="UseDevelopmentStorage=true"/>
  <!--<param name="ConnectionStringName" value="GlobalConfigurationString" />-->
  <param name="AsText" value="true" />
  • myContainer should be ContainerName
  • MyFolder should be DirectoryName
  • AzureBlobConnectionString should be ConnectionStringName