Hi everyone,
I’m trying to make my application
support Logging but I’m very new at
this approach.
I were going to add new tables to my database for each table that i want
to support logging to it and then deal
wit that by my DAL “EF in my
approach”. But this will make me add a
lot of work to both DB and DAL.So i wonder if there is an easier way to do this ?? I don’t know maybe
something like “Log Provider” or SQL
Server Triggers or something ??please support me with your advices even in general ideas about support
logging.…
Edit1:
For example suppose that I’ve “Persons” table and “Person” Model i want to support logging to my person table so i want to know when and what happened to some person data at specific time. I hope the point is clear !.
.
Edit2:
Sorry for my blind and not clear question but i just realize that the Triggers is just the best way to do what i want to do.
sorry again ;}
I’m currently working on an ASP.NET MVC application. This provides the ability to add custom filters to action methods. These are attribute classes inheriting from
System.Web.Mvc.ActionFilterAttribute.I simply decorate any action method I wish to log (or the controller class for all methods) with something like ‘[Log(LogLevel.High)]’. The
LogAttributeclass which provides this has a dependancy on my interfaceILoggingProviderwhich contains aWritemethod (the concrete implementation logs to database). I handle theOnActionExecutedevent in theLogAttributeclass and use the eventargs to construct the data to pass to theWritemethod. If you wanted to log results too you could also log theOnResultExecutedevent.