serilog-sinks-seq: MissingMethodException - Serilog.LoggerConfiguration Serilog.SeqLoggerConfigurationExtensions.Seq()

I’m getting this exception when starting up my Azure Function App locally from Visual Studio:

System.MissingMethodException: 'Method not found: 'Serilog.LoggerConfiguration Serilog.SeqLoggerConfigurationExtensions.Seq(Serilog.Configuration.LoggerSinkConfiguration, System.String, Serilog.Events.LogEventLevel, Int32, System.Nullable`1<System.TimeSpan>, System.String, System.String, System.Nullable`1<Int64>, System.Nullable`1<Int64>, Serilog.Core.LoggingLevelSwitch, System.Net.Http.HttpMessageHandler, System.Nullable`1<Int64>, Boolean, Int32)'.

My LoggerConfiguration is:

var environmentName = CloudConfigurationManager.GetSetting("Environment") ?? "Local";
var seqPath = CloudConfigurationManager.GetSetting("SeqPath") ?? "http://localhost:5341/";
var seqApiKey = CloudConfigurationManager.GetSetting("SeqApiKey") ?? "";
var levelSwitch = new LoggingLevelSwitch();

var loggerConfiguration = new LoggerConfiguration()
    .WriteTo.Seq(seqPath, apiKey: seqApiKey, controlLevelSwitch: levelSwitch)
    .WriteTo.TraceWriter(traceWriter)
    .MinimumLevel.ControlledBy(levelSwitch)
    .Enrich.WithProperty("Environment", environmentName);

If I remove this line, the problem goes away:

.WriteTo.Seq(seqPath, apiKey: seqApiKey, controlLevelSwitch: levelSwitch)

I’m using…

  • Visual Studio 15.3.0 Preview 2.0 (required for the Azure Functions tooling)
  • .NET Framework 4.6.2
  • Any CPU
  • Conditional compilation symbols: NET462
  • The following packages:
    <PackageReference Include="Microsoft.Azure.WebJobs" Version="2.1.0-beta1" />
    <PackageReference Include="Microsoft.Azure.WebJobs.Extensions" Version="2.1.0-beta1" />
    <PackageReference Include="Microsoft.Azure.WebJobs.Extensions.Http" Version="1.0.0-beta1" />
    <PackageReference Include="Microsoft.Azure.WebJobs.ServiceBus" Version="2.1.0-beta1" />
    <PackageReference Include="Microsoft.WindowsAzure.ConfigurationManager" Version="3.2.3" />
    <PackageReference Include="Newtonsoft.Json" Version="9.0.1" />
    <PackageReference Include="Microsoft.NET.Sdk.Functions" Version="1.0.0-alpha3" />
    <PackageReference Include="Serilog" Version="2.4.0" />
    <PackageReference Include="Serilog.Sinks.AzureWebJobsTraceWriter" Version="1.0.20" />
    <PackageReference Include="Serilog.Sinks.Seq" Version="3.3.1" />

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 18 (8 by maintainers)

Most upvoted comments

Right, I’ve made some progress. This reproduces the issue:

https://github.com/tjrobinson/SerilogSeqIssue70

Removing the reference to System.Net.Http 4.3.2 fixes it!

Unfortunately that’s not possible in my real usage but it’s a clue.