using System.Web.Mvc; using MileageTraker.Web.Attributes; using MileageTraker.Web.DAL; namespace MileageTraker.Web.Controllers { [UserActivity] public class ControllerBase : Controller { protected readonly DataService DataService = new DataService(); protected override void Dispose(bool disposing) { DataService.Dispose(); base.Dispose(disposing); } protected override void OnException(ExceptionContext filterContext) { if (filterContext != null && filterContext.Exception != null) { var controller = filterContext.RouteData.Values["controller"].ToString(); var action = filterContext.RouteData.Values["action"].ToString(); var loggerName = string.Format("{0}Controller.{1}", controller, action); log4net.LogManager.GetLogger(loggerName).Error(string.Empty, filterContext.Exception); } base.OnException(filterContext); } } }