You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When deploying on Azure, it often makes sense not to put storage connection strings into source code. It is possible to configure them as part of the portal service configuration.
They can then be access via ConfigurationManager.ConnectionStrings.
when configuring AzureTableAppender, and use the same connection definition XXX that is used in other places in the code, anyway.
--- a/log4net.Azure/AzureTableAppender.cs+++ b/log4net.Azure/AzureTableAppender.cs@@ -1,4 +1,5 @@
using System;
+using System.Configuration;
using System.Linq;
using log4net.Appender.Extensions;
using log4net.Appender.Language;
@@ -14,12 +15,19 @@ public class AzureTableAppender : BufferingAppenderSkeleton
private CloudTableClient _client;
private CloudTable _table;
+ public string ConnectionStringName { get; set; }
private string _connectionString;
public string ConnectionString
{
get
{
+ if (!string.IsNullOrWhiteSpace(ConnectionStringName))+ {+ var config = ConfigurationManager.ConnectionStrings[ConnectionStringName];+ if (config != null)+ return config.ConnectionString;+ }
if (String.IsNullOrEmpty(_connectionString))
throw new ApplicationException(Resources.AzureConnectionStringNotSpecified);
return _connectionString;
The text was updated successfully, but these errors were encountered:
When deploying on Azure, it often makes sense not to put storage connection strings into source code. It is possible to configure them as part of the portal service configuration.
They can then be access via ConfigurationManager.ConnectionStrings.
The following patch allows to use
when configuring AzureTableAppender, and use the same connection definition
XXX
that is used in other places in the code, anyway.The text was updated successfully, but these errors were encountered: