为什么 NLog 到 Azure blob 存储不起作用?
Why NLog to Azure blob storage doesn't work?
我正在使用 asp.net 核心 2.2,并希望从将日志写入文件切换到 Azure blob 存储。
并且没有写入任何 blob。
nlog.config(部分为简洁起见):
<extensions>
<add assembly="NLog.Web.AspNetCore"/>
<add assembly="NLog.Extensions.AzureBlobStorage" />
</extensions>
<target xsi:type="AzureBlobStorage" name="azure"
container="logs"
connectionString="**REMOVED**"
blobName="test.log"
layout="${longdate}|${event-properties:item=EventId_Id}|${pad:padding=-5:inner=${uppercase:${level}}}|${logger:shortName=true}|${message} ${exception:format=tostring}|url: ${aspnet-request-url}|action: ${aspnet-mvc-action}" />
内部日志:
Error AzureBlobStorageTarget: Failed to initialize blob=test.log in
container=logs Exception: System.NullReferenceException: Object
reference not set to an instance of an object. at
NLog.Targets.BlobStorageTarget.CloudBlobService.InitializeContainer(String
containerName, CancellationToken cancellationToken) at
NLog.Targets.BlobStorageTarget.CloudBlobService.InitializeAndCacheBlobAsync(String
containerName, String blobName, String contentType, CancellationToken
cancellationToken)
已尝试 connectionStringKey 替代方案,结果相同。
我在上述存储帐户中有一个 logs 容器。
有什么想法吗?
NLog.Extensions.AzureBlobStorage 2.0.1 版本刚刚发布。
我正在使用 asp.net 核心 2.2,并希望从将日志写入文件切换到 Azure blob 存储。
并且没有写入任何 blob。
nlog.config(部分为简洁起见):
<extensions>
<add assembly="NLog.Web.AspNetCore"/>
<add assembly="NLog.Extensions.AzureBlobStorage" />
</extensions>
<target xsi:type="AzureBlobStorage" name="azure"
container="logs"
connectionString="**REMOVED**"
blobName="test.log"
layout="${longdate}|${event-properties:item=EventId_Id}|${pad:padding=-5:inner=${uppercase:${level}}}|${logger:shortName=true}|${message} ${exception:format=tostring}|url: ${aspnet-request-url}|action: ${aspnet-mvc-action}" />
内部日志:
Error AzureBlobStorageTarget: Failed to initialize blob=test.log in container=logs Exception: System.NullReferenceException: Object reference not set to an instance of an object. at NLog.Targets.BlobStorageTarget.CloudBlobService.InitializeContainer(String containerName, CancellationToken cancellationToken) at NLog.Targets.BlobStorageTarget.CloudBlobService.InitializeAndCacheBlobAsync(String containerName, String blobName, String contentType, CancellationToken cancellationToken)
已尝试 connectionStringKey 替代方案,结果相同。
我在上述存储帐户中有一个 logs 容器。
有什么想法吗?
NLog.Extensions.AzureBlobStorage 2.0.1 版本刚刚发布。