using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Web; using System.Web.Http; using System.Web.Http.Filters; using System.Web.Mvc; using Tango.Core; using Tango.Logging; using Tango.Web.Logging; namespace Tango.Web { public class TangoWebApplication : HttpApplication { //Create filter public class LogExceptionFilterAttribute : ExceptionFilterAttribute { public override void OnException(HttpActionExecutedContext context) { LogManager.Default.Log(context.Exception); } } protected virtual void Application_Start() { LogManager.Default.Categories.Add(LogCategory.Debug); LogManager.Default.RegisterLogger(new AzureCloudLogger()); GlobalConfiguration.Configuration.Filters.Add(new LogExceptionFilterAttribute()); SynchronizedObservableCollectionConfig.DisableSynchronization = true; LogManager.Default.Log("Application Started!"); } protected void Application_Error(object sender, EventArgs e) { Exception exception = Server.GetLastError(); if (exception != null) { LogManager.Default.Log(exception, "Global Exception!"); } } } }