Search code examples
azure-storageazure-blob-storageazure-storage-emulator

log4net log4net.Appender.AzureBlobAppender creating blog container but not logging records


I have an issue where I am using log4net to attempt to log to blog storage. I have log4net debugging enabled and can see there are no errors:

log4net: Loading Appender [BlobAppender] type: [log4net.Appender.AzureBlobAppender, log4net.Appender.Azure]
log4net: Setting Property [ContainerName] to String value [testloggingblob]
log4net: Setting Property [DirectoryName] to String value [logs]
log4net: Setting Property [ConnectionString] to String value [UseDevelopmentStorage=true]
log4net: Created Appender [BlobAppender]
log4net: Adding appender named [BlobAppender] to logger [ProductionLogger].

I am logging to:

UseDevelopmentStorage=true

The container gets created but nothing gets logged:

Here is my config:

my app.config

Here is my container that was created when I ran my code:

generated blob in cloud explorer

Any help would be great.

thanks


Solution

  • Make sure your bufferSize is small enough that you can force it to write to the blob trivially while developing. By default it's 512 so 512 logging events would have to occur before being written to the blob.

    You can change the setting to a much smaller amount to make it write more often. Something like

    <bufferSize value="5" />