Skip to content

Commit 58a19c8

Browse files
committed
Add NLog (close #15)
1 parent 845b1b6 commit 58a19c8

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

src/AdminLTE Template/Global.asax.cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,35 @@
66
using System.Web.Routing;
77
using $safeprojectname$.App_Start;
88
using $safeprojectname$.Controllers;
9+
using NLog;
910

1011
namespace $safeprojectname$
1112
{
1213
public class MvcApplication : HttpApplication
1314
{
15+
private static readonly Logger Log = LogManager.GetCurrentClassLogger();
16+
1417
protected void Application_Start()
1518
{
19+
Log.Info("Starting up...");
1620
AreaRegistration.RegisterAllAreas();
1721
RouteConfig.RegisterRoutes(RouteTable.Routes);
1822
BundleConfig.RegisterBundles(BundleTable.Bundles);
23+
24+
Log.Info("Routes and bundles registered");
25+
Log.Info("Started");
26+
}
27+
28+
protected void Application_End()
29+
{
30+
Log.Info("Stopped");
1931
}
2032

2133
protected void Application_Error(object sender, EventArgs e)
2234
{
2335
var exception = Server.GetLastError();
36+
Log.Error(exception, "Unhandled application exception");
37+
2438
var httpContext = ((HttpApplication)sender).Context;
2539
httpContext.Response.Clear();
2640
httpContext.ClearError();

0 commit comments

Comments
 (0)