vendredi 12 juin 2015

Where to log exceptions?

I have a multi-layered web application, layers are like below.

  1. MyApp.Models
  2. MyApp.Views
  3. MyApp.Controllers
  4. MyApp.Services
  5. MyApp.Repository.EF

In this architecture i have a seperated controllers class project as you may guess. Let's imagine that i want to add a category into db in this application.

For this transaction i follow these project steps below,

Controllers > Services > Repository > DB

For this transaction i follow these method steps in projects below,

CreateAction > CreateCaategory > InsertEntity > CategoryTable

In all of those methods in layers, i use try-catch blocks for loging for any exception occurs. I do wonder it is correct or not? I really bored to write try-catch bloks for loging things in every following steps for possible error in every tier.

What is the best practice to log in multi-layered application like mine?

Aucun commentaire:

Enregistrer un commentaire