Logging of every action call in controller

highway2

If you want to log every action execution in the ASP.NET MVC application.

Instead of adding unnecessary logic ( to logging ) in each action. We can override method OnActionExecuting which belongs to the Contoller class. It is launched every time we enter the action.

Example.

In that way we can do whatever we want with information about what action in the controller was clicked from. If we add additional information – when and who. We can use this in some statistics or something else…

Dodaj komentarz

Twój adres email nie zostanie opublikowany. Pola, których wypełnienie jest wymagane, są oznaczone symbolem *