mirror of
https://github.com/bitwarden/server.git
synced 2025-04-15 01:58:14 -05:00
config for rolling log files by size limit
This commit is contained in:
parent
ac5bc34e77
commit
d270311393
@ -10,6 +10,7 @@ namespace Bit.Core
|
||||
public virtual string StripeApiKey { get; set; }
|
||||
public virtual string ProjectName { get; set; }
|
||||
public virtual string LogDirectory { get; set; }
|
||||
public virtual long? LogRoleBySizeLimit { get; set; }
|
||||
public virtual string LicenseDirectory { get; set; }
|
||||
public string LicenseCertificatePassword { get; set; }
|
||||
public virtual string PushRelayBaseUri { get; set; }
|
||||
|
@ -18,7 +18,7 @@ namespace Bit.Core.Utilities
|
||||
{
|
||||
if(env.IsDevelopment())
|
||||
{
|
||||
return;
|
||||
return;
|
||||
}
|
||||
|
||||
if(CoreHelpers.SettingHasValue(globalSettings?.Sentry.Dsn))
|
||||
@ -35,7 +35,7 @@ namespace Bit.Core.Utilities
|
||||
{
|
||||
if(context.HostingEnvironment.IsDevelopment())
|
||||
{
|
||||
return builder;
|
||||
return builder;
|
||||
}
|
||||
|
||||
bool inclusionPredicate(LogEvent e)
|
||||
@ -77,7 +77,18 @@ namespace Bit.Core.Utilities
|
||||
}
|
||||
else if(CoreHelpers.SettingHasValue(globalSettings.LogDirectory))
|
||||
{
|
||||
config.WriteTo.RollingFile($"{globalSettings.LogDirectory}/{globalSettings.ProjectName}/{{Date}}.txt")
|
||||
if(globalSettings.LogRoleBySizeLimit.HasValue)
|
||||
{
|
||||
config.WriteTo
|
||||
.RollingFile($"{globalSettings.LogDirectory}/{globalSettings.ProjectName}/log.txt",
|
||||
fileSizeLimitBytes: globalSettings.LogRoleBySizeLimit);
|
||||
}
|
||||
else
|
||||
{
|
||||
config.WriteTo
|
||||
.RollingFile($"{globalSettings.LogDirectory}/{globalSettings.ProjectName}/{{Date}}.txt");
|
||||
}
|
||||
config
|
||||
.Enrich.FromLogContext()
|
||||
.Enrich.WithProperty("Project", globalSettings.ProjectName);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user