using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; using log4net; namespace Sleis.Filter { public class ExceptionLoggingFilter : HandleErrorAttribute { private static readonly ILog _log = LogManager.GetLogger(typeof(ExceptionLoggingFilter)); public override bool IsDefaultAttribute() { return true; } public override void OnException(ExceptionContext filterContext) { _log.Error("Exception", filterContext.Exception); if (!filterContext.ExceptionHandled) { _log.Error("Unhandled Exception", filterContext.Exception); } else { base.OnException(filterContext); } } } }