mirror of
https://github.com/bitwarden/server.git
synced 2025-04-06 21:48:12 -05:00
cleanup startup logging
This commit is contained in:
parent
21f614bb2e
commit
5069814c4f
@ -149,28 +149,27 @@ namespace Bit.Api
|
|||||||
IApplicationLifetime appLifetime,
|
IApplicationLifetime appLifetime,
|
||||||
GlobalSettings globalSettings)
|
GlobalSettings globalSettings)
|
||||||
{
|
{
|
||||||
loggerFactory
|
loggerFactory.AddSerilog(env, appLifetime, globalSettings, (e) =>
|
||||||
.AddSerilog(env, appLifetime, globalSettings, (e) =>
|
{
|
||||||
|
var context = e.Properties["SourceContext"].ToString();
|
||||||
|
if(e.Exception != null && (e.Exception.GetType() == typeof(SecurityTokenValidationException) ||
|
||||||
|
e.Exception.Message == "Bad security stamp."))
|
||||||
{
|
{
|
||||||
var context = e.Properties["SourceContext"].ToString();
|
return false;
|
||||||
if(e.Exception != null && (e.Exception.GetType() == typeof(SecurityTokenValidationException) ||
|
}
|
||||||
e.Exception.Message == "Bad security stamp."))
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(context.Contains(typeof(IpRateLimitMiddleware).FullName) && e.Level == LogEventLevel.Information)
|
if(context.Contains(typeof(IpRateLimitMiddleware).FullName) && e.Level == LogEventLevel.Information)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(context.Contains("IdentityServer4.Validation.TokenRequestValidator"))
|
if(context.Contains("IdentityServer4.Validation.TokenRequestValidator"))
|
||||||
{
|
{
|
||||||
return e.Level > LogEventLevel.Error;
|
return e.Level > LogEventLevel.Error;
|
||||||
}
|
}
|
||||||
|
|
||||||
return e.Level >= LogEventLevel.Error;
|
return e.Level >= LogEventLevel.Error;
|
||||||
});
|
});
|
||||||
|
|
||||||
// Default Middleware
|
// Default Middleware
|
||||||
app.UseDefaultMiddleware(env);
|
app.UseDefaultMiddleware(env);
|
||||||
|
@ -64,8 +64,7 @@ namespace Bit.Billing
|
|||||||
GlobalSettings globalSettings,
|
GlobalSettings globalSettings,
|
||||||
ILoggerFactory loggerFactory)
|
ILoggerFactory loggerFactory)
|
||||||
{
|
{
|
||||||
loggerFactory
|
loggerFactory.AddSerilog(env, appLifetime, globalSettings, (e) => e.Level >= LogEventLevel.Error);
|
||||||
.AddSerilog(env, appLifetime, globalSettings, (e) => e.Level >= LogEventLevel.Error);
|
|
||||||
|
|
||||||
if(env.IsDevelopment())
|
if(env.IsDevelopment())
|
||||||
{
|
{
|
||||||
|
@ -46,17 +46,17 @@ namespace Bit.Icons
|
|||||||
IHostingEnvironment env,
|
IHostingEnvironment env,
|
||||||
TelemetryConfiguration telemetry)
|
TelemetryConfiguration telemetry)
|
||||||
{
|
{
|
||||||
|
if(env.IsDevelopment())
|
||||||
|
{
|
||||||
|
app.UseDeveloperExceptionPage();
|
||||||
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
telemetry.DisableTelemetry = true;
|
telemetry.DisableTelemetry = true;
|
||||||
}
|
}
|
||||||
catch { }
|
catch { }
|
||||||
|
|
||||||
if(env.IsDevelopment())
|
|
||||||
{
|
|
||||||
app.UseDeveloperExceptionPage();
|
|
||||||
}
|
|
||||||
|
|
||||||
app.UseResponseCaching();
|
app.UseResponseCaching();
|
||||||
app.UseMvc();
|
app.UseMvc();
|
||||||
}
|
}
|
||||||
|
@ -72,22 +72,21 @@ namespace Bit.Identity
|
|||||||
IApplicationLifetime appLifetime,
|
IApplicationLifetime appLifetime,
|
||||||
GlobalSettings globalSettings)
|
GlobalSettings globalSettings)
|
||||||
{
|
{
|
||||||
loggerFactory
|
loggerFactory.AddSerilog(env, appLifetime, globalSettings, (e) =>
|
||||||
.AddSerilog(env, appLifetime, globalSettings, (e) =>
|
{
|
||||||
|
var context = e.Properties["SourceContext"].ToString();
|
||||||
|
if(context.Contains("IdentityServer4.Validation.TokenRequestValidator"))
|
||||||
{
|
{
|
||||||
var context = e.Properties["SourceContext"].ToString();
|
return e.Level > LogEventLevel.Error;
|
||||||
if(context.Contains("IdentityServer4.Validation.TokenRequestValidator"))
|
}
|
||||||
{
|
|
||||||
return e.Level > LogEventLevel.Error;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(context.Contains(typeof(IpRateLimitMiddleware).FullName) && e.Level == LogEventLevel.Information)
|
if(context.Contains(typeof(IpRateLimitMiddleware).FullName) && e.Level == LogEventLevel.Information)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return e.Level >= LogEventLevel.Error;
|
return e.Level >= LogEventLevel.Error;
|
||||||
});
|
});
|
||||||
|
|
||||||
// Default Middleware
|
// Default Middleware
|
||||||
app.UseDefaultMiddleware(env);
|
app.UseDefaultMiddleware(env);
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
using System.IO;
|
using Microsoft.AspNetCore;
|
||||||
using Microsoft.AspNetCore.Hosting;
|
using Microsoft.AspNetCore.Hosting;
|
||||||
|
|
||||||
namespace Bit.Mail
|
namespace Bit.Mail
|
||||||
@ -7,14 +7,11 @@ namespace Bit.Mail
|
|||||||
{
|
{
|
||||||
public static void Main(string[] args)
|
public static void Main(string[] args)
|
||||||
{
|
{
|
||||||
var host = new WebHostBuilder()
|
WebHost
|
||||||
.UseKestrel()
|
.CreateDefaultBuilder(args)
|
||||||
.UseContentRoot(Directory.GetCurrentDirectory())
|
|
||||||
.UseIISIntegration()
|
|
||||||
.UseStartup<Startup>()
|
.UseStartup<Startup>()
|
||||||
.Build();
|
.Build()
|
||||||
|
.Run();
|
||||||
host.Run();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user