|
18 | 18 | using System.IO;
|
19 | 19 | using System.IO.Abstractions;
|
20 | 20 | using Ardalis.GuardClauses;
|
21 |
| -using Elasticsearch.Extensions.Logging; |
| 21 | +using FellowOakDicom.Log; |
22 | 22 | using Microsoft.AspNetCore.Hosting;
|
23 | 23 | using Microsoft.EntityFrameworkCore;
|
24 | 24 | using Microsoft.Extensions.Configuration;
|
|
45 | 45 | using Monai.Deploy.Messaging.Configuration;
|
46 | 46 | using Monai.Deploy.Storage;
|
47 | 47 | using Monai.Deploy.Storage.Configuration;
|
| 48 | +using NLog.Web; |
48 | 49 |
|
49 | 50 | namespace Monai.Deploy.InformaticsGateway
|
50 | 51 | {
|
@@ -84,11 +85,10 @@ internal static IHostBuilder CreateHostBuilder(string[] args) =>
|
84 | 85 | .AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true, reloadOnChange: false)
|
85 | 86 | .AddEnvironmentVariables();
|
86 | 87 | })
|
87 |
| - .ConfigureLogging((builderContext, configureLogging) => |
| 88 | + .ConfigureLogging((builderContext, builder) => |
88 | 89 | {
|
89 |
| - configureLogging.AddConfiguration(builderContext.Configuration.GetSection("Logging")); |
90 |
| - configureLogging.AddFile(o => o.RootPath = AppContext.BaseDirectory); |
91 |
| - configureLogging.AddElasticsearch(); |
| 90 | + builder.ClearProviders(); |
| 91 | + builder.SetMinimumLevel(Microsoft.Extensions.Logging.LogLevel.Trace); |
92 | 92 | })
|
93 | 93 | .ConfigureServices((hostContext, services) =>
|
94 | 94 | {
|
@@ -120,14 +120,13 @@ internal static IHostBuilder CreateHostBuilder(string[] args) =>
|
120 | 120 |
|
121 | 121 | services.AddMonaiDeployStorageService(hostContext.Configuration.GetSection("InformaticsGateway:storage:serviceAssemblyName").Value, Monai.Deploy.Storage.HealthCheckOptions.ServiceHealthCheck);
|
122 | 122 |
|
123 |
| - |
124 | 123 | services.AddMonaiDeployMessageBrokerPublisherService(hostContext.Configuration.GetSection("InformaticsGateway:messaging:publisherServiceAssemblyName").Value, true);
|
125 | 124 | services.AddMonaiDeployMessageBrokerSubscriberService(hostContext.Configuration.GetSection("InformaticsGateway:messaging:subscriberServiceAssemblyName").Value, true);
|
126 | 125 |
|
127 | 126 | services.AddSingleton<ConfigurationValidator>();
|
128 | 127 | services.AddSingleton<IObjectUploadQueue, ObjectUploadQueue>();
|
129 | 128 | services.AddSingleton<IPayloadAssembler, PayloadAssembler>();
|
130 |
| - services.AddSingleton<FellowOakDicom.Log.ILogManager, Logging.FoDicomLogManager>(); |
| 129 | + services.AddSingleton<FellowOakDicom.Log.ILogManager, NLogManager>(); |
131 | 130 | services.AddSingleton<IMonaiServiceLocator, MonaiServiceLocator>();
|
132 | 131 | services.AddSingleton<IStorageInfoProvider, StorageInfoProvider>();
|
133 | 132 | services.AddSingleton<IMonaiAeChangedNotificationService, MonaiAeChangedNotificationService>();
|
@@ -174,6 +173,7 @@ internal static IHostBuilder CreateHostBuilder(string[] args) =>
|
174 | 173 | webBuilder.ConfigureKestrel(options => options.Limits.MaxRequestBodySize = int.MaxValue);
|
175 | 174 | webBuilder.CaptureStartupErrors(true);
|
176 | 175 | webBuilder.UseStartup<Startup>();
|
177 |
| - }); |
| 176 | + }) |
| 177 | + .UseNLog(); |
178 | 178 | }
|
179 | 179 | }
|
0 commit comments