I currently display a custom-styled error message to the users, that I've built following this post. This works fine, but I'm wondering how I should actually log these errors in the log-file. Currently we've implemented log4net for logging.
Here's my template:
@model System.Web.Mvc.HandleErrorInfo
<div class="span3"></div>
<div class="span5">
<div class="well">
<h3>Oops!</h3>
<div class="alert alert-info alert-block">
<strong>An error has occurred</strong>
<p>
We have logged the incident for you.
Should it continue to occur, please contact support via one of the following options
</p>
<br />
<p class="pull-right"><a href="mailto:support@company.com">support@company.com</a></p>
<address>
<strong>Company Inc.</strong><br>
Address 3<br>
0055 Somewhere, Country<br>
<abbr title="Phone">P:</abbr>
+47 999 99 999
</address>
</div>
<div class="alert alert-error alert-block">
<strong>Exception details (@Model.ControllerName / @Model.ActionName)</strong>
<p>
@Model.Exception.Message
</p>
</div>
</div>
</div>
Web.config:
<customErrors mode="On">
<error statusCode="404" redirect="~/Error404/Index" />
</customErrors>
Note that the Error404 view has its own controller and resides in its own view-folder, whereas my Error.cshtml view does not - it resides in the shared folder, together with my layouts. Any help would be appreciated :)