proudmonkey / AutoWrapper

A simple, yet customizable global exception handler and Http response wrapper for ASP.NET Core APIs.
MIT License
677 stars 82 forks source link

custom logging #79

Closed venu8486 closed 4 years ago

venu8486 commented 4 years ago

Is it possible to log the request/response logging using nlog?

hueifeng commented 4 years ago

@venu8486 For request/response log is not in the range of AutoWrapper processing, I think you can by other means of aspnetcore frame log records, for example through the interceptor mechanism of aspnetcore framework for request/response records, or in the form of custom Middleware to do logging, even said that you can also through diagnostic tools to make response to aspnetcore framework of monitor log records.

proudmonkey commented 4 years ago

@venu8486 . .NET Core supports a logging API that works with a variety of built-in and third-party logging providers inlcuding NLog. Depending on what supported .NET Core logging provider you use and how you configure the location to log the data (e.g text file, Cloud , etc. ), AutoWrapper will automatically write the logs there for you. The only limitation is that you can't control the log format from AutoWrapper. If you want to create a more structured logging based on your preference, then you can implement a custom middleware that handles that.

venu8486 commented 4 years ago

Thank you very much for your quick reply @proudmonkey @hueifeng