mirror of
https://github.com/bitwarden/server.git
synced 2024-12-25 17:27:45 +01:00
cleanup logs
This commit is contained in:
parent
702d833cea
commit
13db0285c9
@ -62,7 +62,7 @@ namespace Bit.Admin
|
|||||||
GlobalSettings globalSettings,
|
GlobalSettings globalSettings,
|
||||||
ILoggerFactory loggerFactory)
|
ILoggerFactory loggerFactory)
|
||||||
{
|
{
|
||||||
loggerFactory.AddSerilog(env, appLifetime, globalSettings, (e) => e.Level >= LogEventLevel.Error);
|
loggerFactory.AddSerilog(app, env, appLifetime, globalSettings, (e) => e.Level >= LogEventLevel.Error);
|
||||||
|
|
||||||
if(env.IsDevelopment())
|
if(env.IsDevelopment())
|
||||||
{
|
{
|
||||||
|
@ -69,10 +69,10 @@
|
|||||||
<PackageReference Include="Serilog.Extensions.Logging" Version="2.0.2" />
|
<PackageReference Include="Serilog.Extensions.Logging" Version="2.0.2" />
|
||||||
<PackageReference Include="Serilog.Extensions.Logging.File" Version="1.1.0" />
|
<PackageReference Include="Serilog.Extensions.Logging.File" Version="1.1.0" />
|
||||||
<PackageReference Include="Serilog.Sinks.AzureDocumentDB" Version="3.8.0" />
|
<PackageReference Include="Serilog.Sinks.AzureDocumentDB" Version="3.8.0" />
|
||||||
|
<PackageReference Include="Serilog.Sinks.Sentry.AspNetCore" Version="2.1.4" />
|
||||||
<PackageReference Include="IdentityServer4" Version="2.1.2" />
|
<PackageReference Include="IdentityServer4" Version="2.1.2" />
|
||||||
<PackageReference Include="Dapper" Version="1.50.4" />
|
<PackageReference Include="Dapper" Version="1.50.4" />
|
||||||
<PackageReference Include="Newtonsoft.Json" Version="11.0.1" />
|
<PackageReference Include="Newtonsoft.Json" Version="11.0.1" />
|
||||||
<PackageReference Include="Serilog.Sinks.Sentry.AspNetCore" Version="2.1.4" />
|
|
||||||
<PackageReference Include="WindowsAzure.Storage" Version="9.0.0" />
|
<PackageReference Include="WindowsAzure.Storage" Version="9.0.0" />
|
||||||
<PackageReference Include="AspNetCoreRateLimit" Version="2.1.0" />
|
<PackageReference Include="AspNetCoreRateLimit" Version="2.1.0" />
|
||||||
<PackageReference Include="Braintree" Version="3.12.0" />
|
<PackageReference Include="Braintree" Version="3.12.0" />
|
||||||
|
@ -28,13 +28,13 @@ namespace Bit.Core.Utilities
|
|||||||
.Enrich.FromLogContext()
|
.Enrich.FromLogContext()
|
||||||
.Filter.ByIncludingOnly(filter);
|
.Filter.ByIncludingOnly(filter);
|
||||||
|
|
||||||
if(globalSettings.DocumentDb != null && CoreHelpers.SettingHasValue(globalSettings.DocumentDb.Uri) &&
|
if(CoreHelpers.SettingHasValue(globalSettings?.DocumentDb.Uri) &&
|
||||||
CoreHelpers.SettingHasValue(globalSettings.DocumentDb.Key))
|
CoreHelpers.SettingHasValue(globalSettings?.DocumentDb.Key))
|
||||||
{
|
{
|
||||||
config.WriteTo.AzureDocumentDB(new Uri(globalSettings.DocumentDb.Uri), globalSettings.DocumentDb.Key,
|
config.WriteTo.AzureDocumentDB(new Uri(globalSettings.DocumentDb.Uri),
|
||||||
timeToLive: TimeSpan.FromDays(7));
|
globalSettings.DocumentDb.Key, timeToLive: TimeSpan.FromDays(7));
|
||||||
}
|
}
|
||||||
else if(globalSettings.Sentry != null && CoreHelpers.SettingHasValue(globalSettings.Sentry.Dsn))
|
else if(CoreHelpers.SettingHasValue(globalSettings?.Sentry.Dsn))
|
||||||
{
|
{
|
||||||
config.WriteTo.Sentry(globalSettings.Sentry.Dsn)
|
config.WriteTo.Sentry(globalSettings.Sentry.Dsn)
|
||||||
.Enrich.FromLogContext()
|
.Enrich.FromLogContext()
|
||||||
@ -46,7 +46,8 @@ namespace Bit.Core.Utilities
|
|||||||
}
|
}
|
||||||
else if(CoreHelpers.SettingHasValue(globalSettings.LogDirectory))
|
else if(CoreHelpers.SettingHasValue(globalSettings.LogDirectory))
|
||||||
{
|
{
|
||||||
config.WriteTo.RollingFile($"{globalSettings.LogDirectory}/{globalSettings.ProjectName}/{{Date}}.txt");
|
config.WriteTo.RollingFile(
|
||||||
|
$"{globalSettings.LogDirectory}/{globalSettings.ProjectName}/{{Date}}.txt");
|
||||||
}
|
}
|
||||||
|
|
||||||
var serilog = config.CreateLogger();
|
var serilog = config.CreateLogger();
|
||||||
|
Loading…
Reference in New Issue
Block a user