![]() If you would like to prevent any automatic log clearance you can use isAutoClear = false in the configuration of the service. If you don't want to store your logs for too long as it easily can clutter things up, you can set up a frequency/time interval for how often the logs should automatically be cleared. This library got some great built-in features you can use to get even more functionality without having to add more than a few lines of code, all of them are optional. ![]() Below is a list of how to get the most from WatchDog. That is actually all you have to do in order to get this cool logging service up and running. I have made a request for the weather forecast endpoint and this is the result of the logging service now available at WatchLog for Weather Forecast GET Request We have added middleware to register requests and responses + the exception logging service.We have added using WatchDog to the block of using statements.Add middleware and setup username + password. Learn more about configuring Swagger/OpenAPI at ī() ī() // Register services for logging serviceĪpp.UseWatchDogExceptionLogger() // Add Exception logging Var builder = WebApplication.CreateBuilder(args) Go ahead and open up program.cs and add the following code inside the file: ![]() To make this new library/dependency work, we have to register it in our program.cs file. You can read these official guides from Microsoft about how to install packages via Visual Studio or CLI. Below is the command I used to add the package to my demo project for this tutorial. You can do this using the Package Console or by opening the GUI in Visual Studio and searching for “ WatchDog.NET”. The first thing we have to do is install WatchDog.NET from the NuGet store. We will now add WatchDog to a sample Web API I have made out of the default ASP.NET Core Web API template in Visual Studio. Let's move on to the part where it gets fun. Filtering Option for HTTP Logs using HTTP Methods and StatusCode.Search Option for HTTP and Exception Logs.RealTime HTTP Request and Response Logger.Some of the features in WatchDog include: If you ask me WatchDog is in my top 5 list of open-source logging tools when making web apps using. ![]() WatchDog allows us to do searching, filtering, pagination, automatic clearing of logs, or even forward the logs to an external database running either MS SQL, MySQL, Postgresql, or LiteDB if you would prefer a lightweight solution, and add authentication, etc. It leverages SignalR for real-time monitoring and LiteDb a Serverless MongoDB-like database with no configuration with the option of using your external MSSQL, MySQl or Postgres databases. It allows developers log and view messages, events, http requests made to their web application and also exception caught during runtime in their web applications, all in Realtime. What is WatchDog?įrom GitHub by the author: WatchDog is a Realtime Message, Event, HTTP (Request & Response) and Exception logger and viewer for ASP.Net Core Web Apps and APIs. To make it even easier, I have created a video tutorial showing you step-by-step how you can implement WatchDog into your own. The final result you will end up with will look like this when running: WatchDog web interface Video Tutorial
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |