diff --git a/Bootstrap.Admin/Bootstrap.Admin.csproj b/Bootstrap.Admin/Bootstrap.Admin.csproj index 6c1efb32..b5801c33 100644 --- a/Bootstrap.Admin/Bootstrap.Admin.csproj +++ b/Bootstrap.Admin/Bootstrap.Admin.csproj @@ -20,6 +20,7 @@ + diff --git a/Bootstrap.Admin/Startup.cs b/Bootstrap.Admin/Startup.cs index d9438495..f12359d9 100644 --- a/Bootstrap.Admin/Startup.cs +++ b/Bootstrap.Admin/Startup.cs @@ -13,8 +13,10 @@ using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.Versioning; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Logging; using Newtonsoft.Json; using Newtonsoft.Json.Serialization; +using Rollbar.NetCore.AspNet; using Swashbuckle.AspNetCore.Swagger; using System; using System.IO; @@ -70,6 +72,10 @@ namespace Bootstrap.Admin services.AddSignalR().AddJsonProtocalDefault(); services.AddSignalRExceptionFilterHandler(async (client, ex) => await SignalRManager.Send(client, ex)); services.AddResponseCompression(); + services.AddRollbarLogger(loggerOptions => + { + loggerOptions.Filter = (loggerName, loglevel) => loglevel >= LogLevel.Trace; + }); services.AddMvc(options => { options.Filters.Add(); @@ -137,6 +143,7 @@ namespace Bootstrap.Admin app.UseOnlineUsers(callback: TraceHelper.Save); app.UseCacheManagerCorsHandler(); app.UseSignalR(routes => { routes.MapHub("/NotiHub"); }); + app.UseRollbarMiddleware(); app.UseMvc(routes => { routes.MapRoute( diff --git a/Bootstrap.Admin/appsettings.json b/Bootstrap.Admin/appsettings.json index cb71eb2f..8340c091 100644 --- a/Bootstrap.Admin/appsettings.json +++ b/Bootstrap.Admin/appsettings.json @@ -12,6 +12,10 @@ "FileName": "Error\\Log.log" } }, + "Rollbar": { + "AccessToken": "2fbdc15dff334a73a5542e6e82309a35", + "Environment": "AspNetCoreMiddlewareTest" + }, "ConnectionStrings": { "ba": "Data Source=.;Initial Catalog=BootstrapAdmin;User ID=sa;Password=sa" },