99 using Infrastructure ;
1010 using Infrastructure . Metrics ;
1111 using Microsoft . Extensions . Hosting ;
12- using Microsoft . Extensions . Logging ;
1312 using NServiceBus ;
13+ using NServiceBus . Logging ;
1414 using NServiceBus . Transport ;
1515 using Persistence ;
1616 using Persistence . UnitOfWork ;
@@ -66,7 +66,7 @@ public ErrorIngestion(
6666 ingestionState . ReportError ,
6767 ingestionState . Clear ,
6868 settings . TimeToRestartErrorIngestionAfterFailure ,
69- logger
69+ Logger
7070 ) ;
7171 }
7272
@@ -109,11 +109,11 @@ protected override async Task ExecuteAsync(CancellationToken stoppingToken)
109109
110110 if ( e is OperationCanceledException && stoppingToken . IsCancellationRequested )
111111 {
112- logger . LogInformation ( e , "Batch cancelled" ) ;
112+ Logger . Info ( "Batch cancelled" , e ) ;
113113 break ;
114114 }
115115
116- logger . LogInformation ( e , "Ingesting messages failed" ) ;
116+ Logger . Info ( "Ingesting messages failed" , e ) ;
117117 }
118118 finally
119119 {
@@ -146,7 +146,7 @@ public override async Task StopAsync(CancellationToken cancellationToken)
146146 }
147147 catch ( OperationCanceledException e ) when ( cancellationToken . IsCancellationRequested )
148148 {
149- logger . LogInformation ( e , "Shutdown cancelled" ) ;
149+ Logger . Info ( "Shutdown cancelled" , e ) ;
150150 }
151151 }
152152 }
@@ -160,7 +160,7 @@ async Task EnsureStarted(CancellationToken cancellationToken = default)
160160
161161 var canIngest = unitOfWorkFactory . CanIngestMore ( ) ;
162162
163- logger . LogDebug ( "Ensure started {CanIngest }" , canIngest ) ;
163+ Logger . DebugFormat ( "Ensure started {0 }" , canIngest ) ;
164164
165165 if ( canIngest )
166166 {
@@ -194,13 +194,13 @@ async Task SetUpAndStartInfrastructure(CancellationToken cancellationToken)
194194 {
195195 if ( messageReceiver != null )
196196 {
197- logger . LogDebug ( "Infrastructure already Started" ) ;
197+ Logger . Debug ( "Infrastructure already Started" ) ;
198198 return ;
199199 }
200200
201201 try
202202 {
203- logger . LogInformation ( "Starting infrastructure" ) ;
203+ Logger . Info ( "Starting infrastructure" ) ;
204204 transportInfrastructure = await transportCustomization . CreateTransportInfrastructure (
205205 errorQueue ,
206206 transportSettings ,
@@ -219,24 +219,24 @@ async Task SetUpAndStartInfrastructure(CancellationToken cancellationToken)
219219
220220 await messageReceiver . StartReceive ( cancellationToken ) ;
221221
222- logger . LogInformation ( LogMessages . StartedInfrastructure ) ;
222+ Logger . Info ( LogMessages . StartedInfrastructure ) ;
223223 }
224224 catch ( Exception e )
225225 {
226- logger . LogError ( e , "Failed to start infrastructure" ) ;
226+ Logger . Error ( "Failed to start infrastructure" , e ) ;
227227 throw ;
228228 }
229229 }
230230 async Task StopAndTeardownInfrastructure ( CancellationToken cancellationToken )
231231 {
232232 if ( transportInfrastructure == null )
233233 {
234- logger . LogDebug ( "Infrastructure already Stopped" ) ;
234+ Logger . Debug ( "Infrastructure already Stopped" ) ;
235235 return ;
236236 }
237237 try
238238 {
239- logger . LogInformation ( "Stopping infrastructure" ) ;
239+ Logger . Info ( "Stopping infrastructure" ) ;
240240 try
241241 {
242242 if ( messageReceiver != null )
@@ -252,11 +252,11 @@ async Task StopAndTeardownInfrastructure(CancellationToken cancellationToken)
252252 messageReceiver = null ;
253253 transportInfrastructure = null ;
254254
255- logger . LogInformation ( LogMessages . StoppedInfrastructure ) ;
255+ Logger . Info ( LogMessages . StoppedInfrastructure ) ;
256256 }
257257 catch ( Exception e )
258258 {
259- logger . LogError ( e , "Failed to stop infrastructure" ) ;
259+ Logger . Error ( "Failed to stop infrastructure" , e ) ;
260260 throw ;
261261 }
262262 }
@@ -284,7 +284,7 @@ async Task OnMessage(MessageContext messageContext, CancellationToken cancellati
284284
285285 Task OnCriticalError ( string failure , Exception exception )
286286 {
287- logger . LogCritical ( exception , "OnCriticalError. '{FailureMessage }'" , failure ) ;
287+ Logger . Fatal ( $ "OnCriticalError. '{ failure } '", exception ) ;
288288 return watchdog . OnFailure ( failure ) ;
289289 }
290290
@@ -322,7 +322,7 @@ async Task EnsureStopped(CancellationToken cancellationToken = default)
322322 readonly IIngestionUnitOfWorkFactory unitOfWorkFactory ;
323323 readonly IHostApplicationLifetime applicationLifetime ;
324324
325- static readonly ILogger < ErrorIngestion > logger ;
325+ static readonly ILog Logger = LogManager . GetLogger < ErrorIngestion > ( ) ;
326326
327327 internal static class LogMessages
328328 {
0 commit comments