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