diff --git a/Workers/Resgrid.Workers.Console/Program.cs b/Workers/Resgrid.Workers.Console/Program.cs index fe60285b..c1d69d86 100644 --- a/Workers/Resgrid.Workers.Console/Program.cs +++ b/Workers/Resgrid.Workers.Console/Program.cs @@ -53,24 +53,6 @@ static async Task Main(string[] args) LoadConfiguration(args); - Resgrid.Framework.Logging.Initialize(ExternalErrorConfig.ExternalErrorServiceUrlForWebjobs); - - if (!String.IsNullOrWhiteSpace(ExternalErrorConfig.ExternalErrorServiceUrlForWebjobs)) - { - SentrySdk.Init(options => - { - options.Dsn = Config.ExternalErrorConfig.ExternalErrorServiceUrlForWebjobs; - options.AttachStacktrace = true; - options.SendDefaultPii = true; - options.AutoSessionTracking = true; - options.TracesSampleRate = ExternalErrorConfig.SentryPerfSampleRate; - options.ProfilesSampleRate = ExternalErrorConfig.SentryProfilingSampleRate; - options.IsGlobalModeEnabled = true; - options.Environment = ExternalErrorConfig.Environment; - options.Release = Assembly.GetEntryAssembly().GetName().Version.ToString(); - }); - } - Prime(); var builder = new HostBuilder() @@ -104,6 +86,25 @@ static async Task Main(string[] args) logging.AddConsole(); }); + Resgrid.Framework.Logging.Initialize(ExternalErrorConfig.ExternalErrorServiceUrlForWebjobs); + + if (!String.IsNullOrWhiteSpace(ExternalErrorConfig.ExternalErrorServiceUrlForWebjobs)) + { + SentrySdk.Init(options => + { + options.Dsn = Config.ExternalErrorConfig.ExternalErrorServiceUrlForWebjobs; + options.AttachStacktrace = true; + options.SendDefaultPii = true; + options.AutoSessionTracking = true; + options.TracesSampleRate = ExternalErrorConfig.SentryPerfSampleRate; + options.ProfilesSampleRate = ExternalErrorConfig.SentryProfilingSampleRate; + options.IsGlobalModeEnabled = true; + options.Environment = ExternalErrorConfig.Environment; + options.Release = Assembly.GetEntryAssembly().GetName().Version.ToString(); + }); + } + + await builder.RunConsoleAsync(); }