Skip to content

Commit e4f3288

Browse files
committed
Refactor logging settings initialization across services
1 parent c39d01f commit e4f3288

File tree

5 files changed

+5
-4
lines changed

5 files changed

+5
-4
lines changed

src/ServiceControl.Audit/Infrastructure/Settings/Settings.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ public Settings(
2222
LoggingSettings loggingSettings = null
2323
)
2424
{
25+
// TODO: Consider GetRequiredSection ?
2526
IConfiguration serviceBusSection = configuration.GetSection(SectionNameServiceBus);
2627
IConfiguration serviceControlAuditsection = configuration.GetSection(SectionName);
2728
IConfiguration serviceControlSection = configuration.GetSection(SectionNameServiceControl);

src/ServiceControl.Monitoring/Program.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
var section = bootstrapConfig.GetSection(Settings.SectionName);
2020

21-
var loggingSettings = LoggingSettingsFactory.Create(bootstrapConfig);
21+
var loggingSettings = LoggingSettingsFactory.Create(section);
2222
LoggingConfigurator.ConfigureLogging(loggingSettings);
2323
logger = LoggerUtil.CreateStaticLogger<Program>();
2424

src/ServiceControl.Monitoring/Settings.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,8 @@ public Settings() { }
1818

1919
public Settings(ILogger<Settings> logger, IConfigurationSection section, LoggingSettings loggingSettings, string transportType = null)
2020
{
21-
LoggingSettings = loggingSettings; // TODO: Previously had a COALESCE
21+
LoggingSettings = loggingSettings;
2222

23-
// Overwrite the instance name if it is specified in ENVVAR, reg, or config file
2423
InstanceName = section.GetValue("InstanceName", DEFAULT_INSTANCE_NAME);
2524

2625
TransportType = section.GetValue("TransportType", transportType);

src/ServiceControl/Infrastructure/Settings/Settings.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ public class Settings
1313
{
1414
public ServiceControlSettings ServiceControlSettings { get; set; }
1515
[JsonIgnore] public Func<string, AssemblyLoadContext> AssemblyLoadContextResolver { get; set; }
16-
public LoggingSettings LoggingSettings { get; set; }
16+
public LoggingSettings LoggingSettings { get; set; } = new ();
1717
public string NotificationsFilter { get; set; }
1818
public bool AllowMessageEditing { get; set; }
1919
public Func<MessageContext, bool> MessageFilter { get; set; } //HINT: acceptance tests only

src/ServiceControl/Program.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
var bootstrapSettings = section.Get<Settings>();
2525

2626
var loggingSettings = LoggingSettingsFactory.Create(section);
27+
bootstrapSettings.LoggingSettings = loggingSettings; // TODO: Remove this when we have a better way to pass logging settings to the host
2728

2829
LoggingConfigurator.ConfigureLogging(loggingSettings);
2930

0 commit comments

Comments
 (0)