How can I suppress some of the "DBG" and "INF" messages output by the dotnet run command?

31 Views Asked by At

While working on an ASP.NET Core 8 Blazor app, I usually use JetBrains Rider to run/debug the project for me, but just look at all this noise generated by ABP and other library components that I won't ever touch and therefore don't care about:

kenny@MacBook-Pro:~/Dev/MyProject$ dotnet run -v q --no-build --project ./src/MyCompany.MyProject.Blazor/MyCompany.MyProject.Blazor.csproj

[13:33:36 INF] Starting web host.
[13:33:38 INF] Loaded ABP modules:
[13:33:38 INF] - MyCompany.MyProject.Blazor.MyProjectBlazorModule
[13:33:38 INF]   - MyCompany.MyProject.MyProjectApplicationModule

// ...hundreds more lines listing all the loaded modules unnecessarily

[13:33:38 INF] Registering datasource 'default' with db provider: 'Quartz.Impl.AdoJobStore.Common.DbProvider'
[13:33:38 INF] Using object serializer: Quartz.Simpl.JsonObjectSerializer, Quartz.Serialization.Json
[13:33:38 DBG] Adding TriggerPersistenceDelegate of type: Quartz.Impl.AdoJobStore.SimpleTriggerPersistenceDelegate
[13:33:38 DBG] Adding TriggerPersistenceDelegate of type: Quartz.Impl.AdoJobStore.CronTriggerPersistenceDelegate

// ...many more lines listing all the Quartz TriggerPersistenceDelegate additions (don't care!)

[13:33:38 INF] Using db table-based data access locking (synchronization).
[13:33:39 DBG] Prepared SQL: SELECT 1 FROM QRTZ_JOB_DETAILS
[13:33:39 DBG] Prepared SQL: SELECT 1 FROM QRTZ_TRIGGERS

// ...more Quartz SELECT preparations and 1000+ other lines (OK seriously Quartz, this is getting old!)

[13:33:46 INF] Now listening on: https://localhost:44382.        <-- FINALLY!! The **two** lines that I **actually** care about!
[13:33:46 INF] Application started. Press Ctrl+C to shut down.   <-- These tell me that I can now hit reload in the browser

// ...and more Quartz crap, listing *every single query* that is getting run at regular intervals (like every few seconds).

I imagine this is dotnet run's fault, as the -v q option seems to do nothing, and I couldn't find any other info from my Googling that suggested a possible solution.

So is there any way I could get rid of all this crap from my terminal, and just print the last two lines when the server is actually ready?

Even better, can I suppress the Quartz.NET messages that follow those lines, and just print any actual errors that occur? MTIA :-)

0

There are 0 best solutions below