I am using NLog Azure Storage Logger. My config is as below,
I don't want to put the storage key in the target. Instead, I will use it from app settings so that I can set the Azure website "Application Settings" in the deployment environment. How can I programmatically set the connectionString
for this target?
<nlog xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform"
xmlns="http://www.nlog-project.org/schemas/NLog.xsd">
<target type="AzureAppendBlob"
name="azure"
layout="${longdate} ${level:uppercase=true} - ${message}"
connectionString="DefaultEndpointsProtocol=https;AccountName=mylogs;AccountKey=xxxoxxx=="
container="myappcontainer"
blobName="${date:format=yyyy-MM-dd}.log" />
Looking for something like,
public class NLogService: IMyLogService
{
....
public NLogService()
{
Logger azureLogger = LogManager.GetLogger("AzureAppendBlob");
AzureAppendBlobTarget t = dbLogger.????;
t.ConnectionString = "...";
}
}