"Ideally, the logging functionality would be logically and physically separate from the functionality of each individual page, and adding it to another site would be as simple as dropping an assembly in the site's
/bin
directory."Until today i used to use two classes called Errorlog and ErrorLogDB which are the BO and DAO for the logging. I used to copy this classes to any new application i make. I used to write this code in catch block in every function in every code behind and every method of BL and DAL classes
Old bad way of logging :
catch (Exception ex)
{
ErrorLog er = new ErrorLog(ex, "functionname", "classname");
ErrorLogDB.Persist(er);
}
. Now i realize how wrong this approach is.
Ok !! Never Late than Never. Lets learn the better way :)
No comments:
Post a Comment