WatchDog.NET
1.2.0
Prefix Reserved
See the version list below for details.
dotnet add package WatchDog.NET --version 1.2.0
NuGet\Install-Package WatchDog.NET -Version 1.2.0
<PackageReference Include="WatchDog.NET" Version="1.2.0" />
<PackageVersion Include="WatchDog.NET" Version="1.2.0" />
<PackageReference Include="WatchDog.NET" />
paket add WatchDog.NET --version 1.2.0
#r "nuget: WatchDog.NET, 1.2.0"
#:package WatchDog.NET@1.2.0
#addin nuget:?package=WatchDog.NET&version=1.2.0
#tool nuget:?package=WatchDog.NET&version=1.2.0
WatchDog
Introduction
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.
General Features
- 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
What's New
- Support for External Databases (local & remote)
- Support for MSSQL(SQL Server), MySQL and PostgreSQL Databases
Fixes
- Fixed Middleware order
- Fixed Index pages not showing on MVC Apps
Installation
Install via .NET CLI
dotnet add package WatchDog.NET --version 1.2.0
Install via Package Manager
Install-Package WatchDog.NET --version 1.2.0
Usage
To enable WatchDog to listen for requests, use the WatchDog middleware provided by WatchDog.
Add WatchDog Namespace in Startup.cs
using WatchDog;
Register WatchDog service in Startup.cs under ConfigureService()
services.AddWatchDogServices();
Setup AutoClear Logs Optional
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;
});
Setup Logging to External Db (MSSQL, MySQL & PostgreSQL) Optional
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;
});
Add WatchDog middleware in the HTTP request pipeline in Startup.cs under Configure()
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
Add list of routes you want to ignore by the logger: Optional
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";
});
Add WatchDog Exception Logger Optional
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";
});
View Logs and Exception
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
Contribution
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.
Credit
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
| .NET Core | netcoreapp3.1 is compatible. |
-
.NETCoreApp 3.1
- Dapper (>= 2.0.123)
- LiteDB (>= 5.0.11)
- Microsoft.AspNetCore.Http (>= 2.2.2)
- Microsoft.AspNetCore.Http.Abstractions (>= 2.2.0)
- Microsoft.AspNetCore.Mvc (>= 2.2.0)
- Microsoft.AspNetCore.SignalR (>= 1.1.0)
- Microsoft.AspNetCore.SignalR.Core (>= 1.1.0)
- Microsoft.AspNetCore.StaticFiles (>= 2.2.0)
- Microsoft.Extensions.FileProviders.Abstractions (>= 3.1.22)
- Microsoft.Extensions.FileProviders.Embedded (>= 3.1.22)
- Microsoft.Extensions.FileProviders.Physical (>= 3.1.22)
- Microsoft.Extensions.Logging.Abstractions (>= 3.1.22)
- Microsoft.IO.RecyclableMemoryStream (>= 2.2.0)
- MySql.Data (>= 8.0.29)
- Newtonsoft.Json (>= 13.0.1)
- Npgsql (>= 6.0.4)
- System.Data.SqlClient (>= 4.8.3)
-
net6.0
- Dapper (>= 2.0.123)
- LiteDB (>= 5.0.11)
- Microsoft.AspNetCore.Http (>= 2.2.2)
- Microsoft.AspNetCore.Http.Abstractions (>= 2.2.0)
- Microsoft.AspNetCore.Mvc (>= 2.2.0)
- Microsoft.AspNetCore.SignalR (>= 1.1.0)
- Microsoft.AspNetCore.SignalR.Core (>= 1.1.0)
- Microsoft.AspNetCore.StaticFiles (>= 2.2.0)
- Microsoft.Extensions.FileProviders.Abstractions (>= 3.1.22)
- Microsoft.Extensions.FileProviders.Embedded (>= 3.1.22)
- Microsoft.Extensions.FileProviders.Physical (>= 3.1.22)
- Microsoft.Extensions.Logging.Abstractions (>= 3.1.22)
- Microsoft.IO.RecyclableMemoryStream (>= 2.2.0)
- MySql.Data (>= 8.0.29)
- Newtonsoft.Json (>= 13.0.1)
- Npgsql (>= 6.0.4)
- System.Data.SqlClient (>= 4.8.3)
NuGet packages (8)
Showing the top 5 NuGet packages that depend on WatchDog.NET:
| Package | Downloads |
|---|---|
|
LC.Web.Base
LC.Web.Base |
|
|
Chaosage.Core.Setup
Chaosage开发平台API配置规范 |
|
|
JobPro.Configurations.Global
This nuget package contains all the configurations for micro service architecture |
|
|
PluginCore.Plugins.WatchDogPlugin
PluginCore Plugins: WatchDogPlugin |
|
|
Peak.Lib.Web
Package Description |
GitHub repositories (1)
Showing the top 1 popular GitHub repositories that depend on WatchDog.NET:
| Repository | Stars |
|---|---|
|
Jinjinov/OpenHabitTracker
C# .NET 9 Blazor habit tracker application. Works on Web, Windows, Linux, Android, iOS and macOS.
|
| Version | Downloads | Last Updated |
|---|---|---|
| 1.4.12 | 33,052 | 12/21/2024 |
| 1.4.11 | 39,319 | 3/31/2024 |
| 1.4.10 | 42,265 | 5/19/2023 |
| 1.4.7 | 8,054 | 4/19/2023 |
| 1.4.6 | 27,173 | 2/16/2023 |
| 1.4.3 | 22,435 | 2/1/2023 |
| 1.4.2 | 5,651 | 1/18/2023 |
| 1.4.1 | 1,726 | 1/17/2023 |
| 1.4.0 | 3,348 | 1/16/2023 |
| 1.3.3 | 18,791 | 12/14/2022 |
| 1.3.3-rc | 1,670 | 11/7/2022 |
| 1.3.2 | 30,645 | 9/18/2022 |
| 1.3.1 | 7,614 | 8/9/2022 |
| 1.3.0 | 3,995 | 7/19/2022 |
| 1.2.1 | 6,742 | 6/7/2022 |
| 1.2.0 | 2,329 | 5/15/2022 |
- Added support for MSSQL(SQL Server), MySQL and PostgreSQL Databases, Fixed Middleware order, Fixed Index pages not showing on MVC Apps