1

I am using 3 tier architecture in asp.net, I want to put function "ErrorLog()" to log errors, where should I put in my structure?

Chirag Khatsuriya
  • 615
  • 14
  • 27

3 Answers3

1

I suggest you to write your Error log code in your Global.asax file. It has function called Application_Error. This function is called automatically if an unhandled exception is raised.

You can create your log file there. It has Server.GetLastError() function that keeps the track of your last error in your project.

For more details check this link this will help you.

Community
  • 1
  • 1
0

You can create a Uility folder under BLL which holds common functions like CommonFunction.cs class. In that class you can put ErrorLog , AlertMessage,Encrypt , Decrypt ... functions

Lajja Thaker
  • 1,909
  • 8
  • 28
  • 52
0

I would suggest not to put ErrorLog() in any layer (depending on your structure, layer can be a namespace OR a project).

It should be in a Error Utility class and not in any layer, as you might want to use this to log errors from either data layer or business layer.

sak
  • 252
  • 1
  • 13