using System.Web.Mvc; namespace MileageTraker.Web.Controllers { public class ControllerBase : Controller { 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); } } }