Not writing to Seq with Net461 and Configuration installed
See original GitHub issueThis goes in the thoroughly weird bucket and not really expecting any possible fix, but wanted to at least let other people know. If anything, this may be an issue with the Microsoft Configurations package. If all of the following are true;
- You are using the new csproj format in VS2017
- You are targeting net461
- You also install Microsoft.Extensions.Configurations
then the seq sink will silently fail to write to Seq. All the other bits of serilog works fine, just nothing gets sent to Seq.
This may be related to https://github.com/serilog/serilog-sinks-seq/issues/56, though adding <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
doesn’t seem to help.
Given this console app:
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Hello World!");
var logConfig = new LoggerConfiguration().WriteTo.Seq("https://myserver", apiKey: "XXX");
Log.Logger = logConfig.CreateLogger();
Log.Information("TEST");
Log.CloseAndFlush();
}
}
This .csproj does not work
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net461</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Configuration" Version="1.1.1" />
<PackageReference Include="Serilog.Sinks.Seq" Version="3.2.0" />
</ItemGroup>
</Project>
This .csproj works:
(removed Microsoft.Extensions.Configuration)
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net461</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Serilog.Sinks.Seq" Version="3.2.0" />
</ItemGroup>
</Project>
This .csproj works:
(Targeting Net 4.5.1 instead of 4.6.1)
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net451</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Configuration" Version="1.1.1" />
<PackageReference Include="Serilog.Sinks.Seq" Version="3.2.0" />
</ItemGroup>
</Project>
Issue Analytics
- State:
- Created 6 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Not writing to Seq with Net461 and Configuration installed
Configurations. then the seq sink will silently fail to write to Seq. All the other bits of serilog works fine, just nothing gets...
Read more >Writing Seq Apps in netstandard - Seq Documentation
Does Seq Apps support netstandard 2.0 class library? My class library project target netstandard 2.0 and has reference to System.Data.SqlClient.dll 4.8.1.
Read more >ASP.NET Core web api not posting logs to Seq after ...
I have a Web Api project developed with ASP.NET Core 3.1 and have installed Seq for logging. On my development machine, I receive...
Read more >Serilog.Sinks.Seq 5.2.2
Version Downloads Last updated
5.2.3‑dev‑00262 81,241 6 months ago
5.2.3‑dev‑00260 33,111 9 months ago
5.2.3‑dev‑00257 2,162 9 months ago
Read more >Why is Serilog not writing my logs into Seq? (Console app)
Long story short, in Serilog in Console application need to be properly disposed of, application needs to be around try/catch statement and ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@flytzen I’ve had some succeess finding a way around this (I hope) - https://www.nuget.org/packages/Serilog.Sinks.Seq/3.3.0-dev-00110 should cover it, it’d be interesting to hear whether it works in your project. Cheers!
Yep, that seems to have fixed it. Interestingly, I tried the same thing you did with adding a specific NET46 TFM but couldn’t get it to work. However, I didn’t touch the dependencies for netstandard1.x, so wonder if maybe that made a difference. Or maybe I just messed up my tests 😃
Thanks for resolving this!