Store logs into Azure Blob Storage

In this article I will show you how to write logs in Blob table. As log manager in the system I will use Log4net because Blob gives us a great possibility to work with this Log4net. 

Log4Net is a popular logging framework, and if you have an existing application that you wish to move to Azure computer, you probably want to avoid rewriting your application to use another logging framework. Luckily, keeping Log4Net as your logging tool in Azure is certainly possible, but there are a few hoops you have to jump through to get there. So we will write our logs from project to some blob table. For this purpose we can use our project from the previous topic that already have a connection to Azure and to Blob Storage account. So let's start.


In very first step we need to add the Log4net library to our project. We can use NuGet for this purpose. So we should open our MvcApplicationWebRole project and right click on folder References and select “Manage NuGet Packages”. NuGet will occur.  Enter “log4net” in the search window. And press install when it find this library:

Add Log4net library to project - Manage NuGet Packages

Add Log4net library to project