surf68
Looking for a logging solution
Alright so that's pure ADO.NET. Unfortunately, there's no logging mechanism that you can hook into so you're going to have to add the logging yourself. Given this is for a school assignment I assume the application isn't particularly large? If so, I'd suggest tackling things in the following order.
- Pick one method and get it logging its query to a hard-coded JSON file
- Work on adding configuration for where to write that JSON file
- Expand this out to all of the other places you're running SQL
I'm not sure if you're allowed to use external packages or not but if you are you could look into using Serilog which is a very common logging package.
This'll give you a pretty basic solution to the problem but it isn't particularly scalable. Taking it further you could look into adapters around a connection but only you can say whether or not that is what your class is looking for.
9 replies