I am using ASPNet MVC4 with a HandleErrorAttribute filter configured on Global.asax
public static void RegisterGlobalFilters(GlobalFilterCollection filters) { filters.Add(new HandleErrorAttribute()); }
On my web.config, I configured customError mode for RemoteOnly:
<customErrors mode="RemoteOnly" />
So, the user is redirected to ~ / Shared / Error.cshtml, when an exception is thrown on any view, this is normal.
Now I can catch this exception for the log:
~ / General / Error.cshtml code:
@{ log4net.LogManager .GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType) .Fatal("Not captured exception", ex); }
This code actually works fine (without the EX parameter), but I need to improve my log, including exception information.
How can I get exception information on this page?
source share