This Umbraco package adds a log4net appender that uses Azure table storage and extends the Umbraco developer tree with functionality to view these logs.
Using Azure table storage for logs in preference to the file-system has an additional benefit of reducing file replication activity in load balanced environments where the file system is being synchronised such as Azure Web Apps.
Once installed, edit the ConnectionString named "LoggingTableStorage" added to web.config include the name and key of your Azure storage account (ensure the account has the Table service enabled).
If your site is making a lot of log entries (e.g. you've set to DEBUG level) you should adjust the bufferSize value, this sets how often the logs are written to storage.
Example:
<root>
<priority value="Info"/>
<appender-ref ref="AsynchronousLog4NetAppender" />
<appender-ref ref="AllTableAppender"/>
<appender-ref ref="WarningsTableAppender"/>
<appender-ref ref="ReadOnlyTableAppender"/> <!-- enable the ui to read the logs, but prevent this server from writing -->
</root>
<appender name="AllTableAppender" type="Our.Umbraco.AzureLogger.Core.TableAppender, Our.Umbraco.AzureLogger.Core">
<param name="ConnectionString" value="LoggingTableStorage"/>
<param name="TableName" value="UALUmbracoTraceLog"/>
<param name="TreeName" value="All Events"/>
<bufferSize value="5"/><!-- 0 indexed -->
</appender>
<appender name="WarningsTableAppender" type="Our.Umbraco.AzureLogger.Core.TableAppender, Our.Umbraco.AzureLogger.Core">
<param name="ConnectionString" value="LoggingTableStorage"/>
<param name="TableName" value="UALWarnings"/>
<param name="TreeName" value="Warnings"/>
<param name="IconName" value="icon-alert"/>
<threshold value="WARN"/>
<filter type="log4net.Filter.LevelRangeFilter">
<levelMin value="WARN"/>
<levelMax value="ERROR"/>
</filter>
<bufferSize value="0"/><!-- 1 item in buffer -->
</appender>
<appender name="ReadOnlyTableAppender" type="Out.Umbraco.AzureLogger.Core.TableAppender, Our.Umbraco.AzureLogger.Core">
<param name="ConnectionString" value="LoggingTableStorage"/>
<param name="TableName" value="UALReadOnly"/>
<param name="ReadOnly" value="true"/>
</appender>
The ConnectionString param can either be the actual connection string, or a name of a connection string as set in web.config:
<connectionStrings>
<!-- local Azure Storage Emulator -->
<add name="LoggingTableStorage" connectionString="UseDevelopmentStorage=true" />
</connectionStrings>
As a useful enhancement we also now store to URL and SessionId which triggered the log entry to be made, this can be very handy for tracking down issues.
NuGet & Umbraco packages are available
NuGet Packages | Version |
---|---|
Release | |
Pre-release |
Umbraco Packages | |
---|---|
Release | |
Pre-release |
This project is licensed under the Apache 2.0 license.
The project includes WindowsAzure.Storage licensed under the Apache License and Microsoft.Web.Xdt licensed under MS-EULA license.