serilog-sinks-azureblobstorage icon indicating copy to clipboard operation
serilog-sinks-azureblobstorage copied to clipboard

Ambiguous call on .WriteTo.AzureBlobStorage

Open logany-hi opened this issue 2 years ago • 0 comments

I've set up the write to blob storage with the code below.

.WriteTo.AzureBlobStorage(configuration.GetSection("AzureAd").Get<AzureSettings>().BlobContainer,
    outputTemplate: "[{Timestamp:HH:mm:ss} {Level:u3}] {Message:lj} {Exception} {NewLine}",

This produces the following error:

Error CS0121 The call is ambiguous between the following methods or properties: 'LoggerConfigurationAzureBlobStorageExtensions.AzureBlobStorage(LoggerSinkConfiguration, string, LogEventLevel, string, string, string, bool, TimeSpan?, int?, bool, IFormatProvider, ICloudBlobProvider, long?, int?, bool)' and 'LoggerConfigurationAzureBlobStorageExtensions.AzureBlobStorage(LoggerSinkConfiguration, string, IConfiguration, LogEventLevel, string, string, string, bool, TimeSpan?, int?, bool, IFormatProvider, ICloudBlobProvider, long?, int?, bool)'

To get around this, it is necessary to explicitly indicate the value for the connectionString property:

.WriteTo.AzureBlobStorage(connectionString: configuration.GetSection("AzureAd").Get<AzureSettings>().BlobContainer...

My project uses the following packages:

<PackageReference Include="Serilog" Version="2.10.0" />
<PackageReference Include="Serilog.AspNetCore" Version="5.0.0" />
<PackageReference Include="Serilog.Sinks.AzureBlobStorage" Version="3.1.1" />
<PackageReference Include="Serilog.Sinks.Console" Version="4.0.2-dev-00890" />

logany-hi avatar Apr 06 '22 05:04 logany-hi