Skip to content

Commit b825edc

Browse files
committed
fix logger not being available in program.cs
1 parent ddb7568 commit b825edc

File tree

3 files changed

+7
-9
lines changed

3 files changed

+7
-9
lines changed

src/ServiceControl.Audit/Program.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,10 @@
77
using ServiceControl.Configuration;
88
using ServiceControl.Infrastructure;
99

10+
var loggingSettings = new LoggingSettings(Settings.SettingsRootNamespace);
11+
LoggingConfigurator.ConfigureLogging(loggingSettings);
1012
var logger = LoggerUtil.CreateStaticLogger(typeof(Program));
13+
1114
try
1215
{
1316
AppDomain.CurrentDomain.UnhandledException += (s, e) => logger.LogError(e.ExceptionObject as Exception, "Unhandled exception was caught.");
@@ -30,9 +33,6 @@
3033
return 0;
3134
}
3235

33-
var loggingSettings = new LoggingSettings(Settings.SettingsRootNamespace);
34-
LoggingConfigurator.ConfigureLogging(loggingSettings);
35-
3636
var settings = new Settings(loggingSettings: loggingSettings);
3737

3838
await new CommandRunner(arguments.Command).Execute(arguments, settings);

src/ServiceControl.Monitoring/Program.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
using ServiceControl.Infrastructure;
66
using ServiceControl.Monitoring;
77

8+
var loggingSettings = new LoggingSettings(Settings.SettingsRootNamespace);
9+
LoggingConfigurator.ConfigureLogging(loggingSettings);
810
var logger = LoggerUtil.CreateStaticLogger<Program>();
911

1012
try
@@ -23,9 +25,6 @@
2325

2426
var arguments = new HostArguments(args);
2527

26-
var loggingSettings = new LoggingSettings(Settings.SettingsRootNamespace);
27-
LoggingConfigurator.ConfigureLogging(loggingSettings);
28-
2928
var settings = new Settings(loggingSettings: loggingSettings);
3029

3130
await new CommandRunner(arguments.Command).Execute(arguments, settings);

src/ServiceControl/Program.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
using ServiceControl.Hosting.Commands;
88
using ServiceControl.Infrastructure;
99

10+
var loggingSettings = new LoggingSettings(Settings.SettingsRootNamespace);
11+
LoggingConfigurator.ConfigureLogging(loggingSettings);
1012
var logger = LoggerUtil.CreateStaticLogger(typeof(Program));
1113

1214
try
@@ -31,9 +33,6 @@
3133
return 0;
3234
}
3335

34-
var loggingSettings = new LoggingSettings(Settings.SettingsRootNamespace);
35-
LoggingConfigurator.ConfigureLogging(loggingSettings);
36-
3736
var settings = new Settings(loggingSettings: loggingSettings);
3837

3938
await new CommandRunner(arguments.Command).Execute(arguments, settings);

0 commit comments

Comments
 (0)