I'm using TickerQ in my .NET 9 web project and want to suppress all infrastructure logs (SQL, HTTP requests, etc.) so only my own application logs (and errors) show up.
TickerQ Packages:
<PackageReference Include="TickerQ" />
<PackageReference Include="TickerQ.Dashboard" />
<PackageReference Include="TickerQ.EntityFrameworkCore" />
And my logs are getting flooded by TickerQ like this:
[12:28:57 INF] Executed DbCommand (48ms) [Parameters=[:now_1='?' (DbType = DateTime)], CommandType='Text', CommandTimeout='0']
SELECT "d"."ExecutionTime"
FROM "MY_SCHEMA"."MY_SCHEDULER_TIMETICKERS" "d"
WHERE (((("d"."LockHolder" IS NULL) AND ("d"."Status" = 0))) AND ("d"."ExecutionTime" >= :now_1))
ORDER BY "d"."ExecutionTime"
FETCH FIRST 1 ROWS ONLY
[12:28:57 INF] Now listening on: https://localhost:7193
[12:28:57 INF] Now listening on: http://localhost:5055
[12:28:57 INF] Application started. Press Ctrl+C to shut down.
[12:28:57 INF] Hosting environment: Local
[12:28:58 INF] Request starting HTTP/2 GET https://localhost:7193/_framework/aspnetcore-browser-refresh.js - null null
[12:28:58 INF] Request reached the end of the middleware pipeline without being handled by application code. Request path: GET https://localhost:7193/tickerq-dashboard, Response status code: 200
[12:29:00 INF] Request starting HTTP/2 CONNECT https://localhost:7193/tickerq-dashboard/ticker-notification-hub?auth=YWRtaW46YWRtaW4%3D&id=jXG23gXUikW55LxdjtTbsA - null null
[12:29:00 INF] Executed endpoint 'TickerQ.Dashboard.Controllers.TickerQController.GetNextTickerAsync (TickerQ.Dashboard)'
[12:29:00 INF] Executing endpoint 'TickerQ.Dashboard.Controllers.TickerQController.GetOptions (TickerQ.Dashboard)'
[12:29:00 INF] Executed endpoint 'TickerQ.Dashboard.Controllers.TickerQController.GetTickerFunctionsAsync (TickerQ.Dashboard)'
[12:29:00 INF] CORS policy execution successful.
[12:29:00 INF] Request finished HTTP/2 GET https://localhost:7193/tickerq-dashboard/api/ticker-host/:next-ticker - 200 null application/json; charset=utf-8 121.2226ms
I use Serilog and have tried suppressing all Microsoft and TickerQ namespaces except for errors, like this:
"Serilog": {
"MinimumLevel": {
"Default": "Information",
"Override": {
"System": "Error",
"Microsoft": "Error",
"TickerQ": "Error",
"TickerQ.Dashboard": "Error",
"TickerQ.EntityFrameworkCore": "Error"
}
},
"Using": [
"Serilog.Sinks.Console",
"Serilog.Sinks.File",
"Serilog.Enrichers.Environment",
"Serilog.Enrichers.Thread"
],
"WriteTo": [
{
"Name": "Console",
"Args": {
"outputTemplate": "{Timestamp:MM/dd/yyyy HH:mm:ss zzz} {MachineName} {EnvironmentUserName} [{Level:u4}] <{ThreadId}> [{SourceContext:l}] {Message:lj}{NewLine}{Exception}"
},
"theme": "AnsiConsoleTheme.Literate"
},
{
"Name": "File",
"Args": {
"rollingInterval": "Day",
"outputTemplate": "{Timestamp:MM/dd/yyyy HH:mm:ss zzz} {MachineName} {EnvironmentUserName} [{Level:u4}] <{ThreadId}> [{SourceContext:l}] {Message:lj}{NewLine}{Exception}",
"retainedFileCountLimit": 7,
"path": "C:\1円MyTestApps\\MyApp\\log.txt"
}
}
],
"Enrich": [ "FromLogContext", "WithMachineName", "WithThreadId", "WithEnvironmentUserName" ]
}
Despite this, I still see a lot of noise from TickerQ, EF, and ASP.NET Core infrastructure. How to suppress them?
DarkBee
14.6k9 gold badges80 silver badges131 bronze badges
lang-cs