WatchDog is a Realtime HTTP (Request & Response) and Exception logger and viewer for ASP.Net Core Web Apps and APIs. It allows developers log and view http requests made to their web application and also exception caught during runtime in their web applications in Realtime.
It leverages on LiteDb a Serverless MongoDB-like database with no configuration and SignalR for real-time monitoring.
- RealTime HTTP Request and Response Logger
- RealTime Exception Logger
- User Friendly Logger Views
- Search Option for HTTP and Exception Logs
- Filtering Option for HTTP Logs using HTTP Methods and StatusCode
- Logger View Authentication
- Auto Clear Logs Option
- Support for External Databases (local & remote)
- Support for MSSQL(SQL Server), MySQL and PostgreSQL Databases
- Fixed Middleware order
- Fixed Index pages not showing on MVC Apps
Install via .NET CLI
dotnet add package WatchDog.NET --version 1.2.0Install via Package Manager
Install-Package WatchDog.NET --version 1.2.0To enable WatchDog to listen for requests, use the WatchDog middleware provided by WatchDog.
Add WatchDog Namespace in Startup.cs
using WatchDog;services.AddWatchDogServices();This clears the logs after a specific duration.
services.AddWatchDogServices(opt =>
{
opt.IsAutoClear = true;
});NOTE When
IsAutoClear = trueDefault Schedule Time is set to Weekly, override the settings like below:
services.AddWatchDogServices(opt =>
{
opt.IsAutoClear = true;
opt.ClearTimeSchedule = WatchDogAutoClearScheduleEnum.Monthly;
});Add Database Connection String and Choose SqlDriver Option
services.AddWatchDogServices(opt =>
{
opt.IsAutoClear = false;
opt.SetExternalDbConnString = "Server=localhost;Database=testDb;User Id=postgres;Password=root;";
opt.SqlDriverOption = WatchDogSqlDriverEnum.PostgreSql;
});NOTE Add Authentication option like below:
Important
This authentication information (Username and Password) will be used to access the log viewer.
app.UseWatchDog(opt =>
{
opt.WatchPageUsername = "admin";
opt.WatchPagePassword = "Qwerty@123";
});NOTE If your projects startup or program class contains app.UseMvc() or app.UseRouting() then app.UseWatchDog() should come after
ImportantIf your projects startup or program class contains app.UseEndpoints() then app.UseWatchDog() should come beforeImportant
List of routes, paths or specific strings to be ignored should be a comma separated string like below.
app.UseWatchDog(opt =>
{
opt.WatchPageUsername = "admin";
opt.WatchPagePassword = "Qwerty@123";
opt.Blacklist = "Test/testPost, weatherforecast";
});This is used to log in-app exceptions that occur during a particular HTTP request.
NOTE Add Exception Logger before the main WatchDog Middleware, preferably at the top of the middleware hierarchy so as to catch possible early exceptions.
app.UseWatchDogExceptionLogger();
...
app.UseWatchDog(opt =>
{
opt.WatchPageUsername = "admin";
opt.WatchPagePassword = "Qwerty@123";
opt.Blacklist = "Test/testPost, weatherforecast";
});Start your server and head to /watchdog to view the logs.
Example: https://myserver.com/watchdog or https://localhost:[your port]/watchdog
Still confused? Check out the implementation in the WatchDogCompleteTestAPI folder
Feel like something is missing? Fork the repo and send a PR.
Encountered a bug? Fork the repo and send a PR.
Alternatively, open an issue and we'll get to it as soon as we can.




