@@ -279,28 +279,6 @@ protected virtual void Initialize()
279
279
hostConfig . LoggerFactory = new LoggerFactory ( ) ;
280
280
}
281
281
282
- string json = File . ReadAllText ( hostConfigFilePath ) ;
283
- JObject hostConfigObject ;
284
- try
285
- {
286
- hostConfigObject = JObject . Parse ( json ) ;
287
- }
288
- catch ( JsonException ex )
289
- {
290
- throw new FormatException ( string . Format ( "Unable to parse {0} file." , ScriptConstants . HostMetadataFileName ) , ex ) ;
291
- }
292
-
293
- ApplyConfiguration ( hostConfigObject , ScriptConfig ) ;
294
-
295
- if ( string . IsNullOrEmpty ( hostConfig . HostId ) )
296
- {
297
- hostConfig . HostId = Utility . GetDefaultHostId ( _settingsManager , ScriptConfig ) ;
298
- }
299
- if ( string . IsNullOrEmpty ( hostConfig . HostId ) )
300
- {
301
- throw new InvalidOperationException ( "An 'id' must be specified in the host configuration." ) ;
302
- }
303
-
304
282
// Set up a host level TraceMonitor that will receive notification
305
283
// of ALL errors that occur. This allows us to inspect/log errors.
306
284
var traceMonitor = new TraceMonitor ( )
@@ -343,6 +321,37 @@ protected virtual void Initialize()
343
321
_startupLogger = hostConfig . LoggerFactory . CreateLogger ( LogCategories . Startup ) ;
344
322
Logger = hostConfig . LoggerFactory . CreateLogger ( ScriptConstants . LogCategoryHostGeneral ) ;
345
323
324
+ string message = string . Format ( CultureInfo . InvariantCulture , "Reading host configuration file '{0}'" , hostConfigFilePath ) ;
325
+ TraceWriter . Info ( message ) ;
326
+ _startupLogger ? . LogInformation ( message ) ;
327
+
328
+ string json = File . ReadAllText ( hostConfigFilePath ) ;
329
+
330
+ message = $ "Host configuration file read:{ Environment . NewLine } { json } ";
331
+ TraceWriter . Info ( message ) ;
332
+ _startupLogger . LogInformation ( message ) ;
333
+
334
+ JObject hostConfigObject ;
335
+ try
336
+ {
337
+ hostConfigObject = JObject . Parse ( json ) ;
338
+ }
339
+ catch ( JsonException ex )
340
+ {
341
+ throw new FormatException ( string . Format ( "Unable to parse {0} file." , ScriptConstants . HostMetadataFileName ) , ex ) ;
342
+ }
343
+
344
+ ApplyConfiguration ( hostConfigObject , ScriptConfig ) ;
345
+
346
+ if ( string . IsNullOrEmpty ( hostConfig . HostId ) )
347
+ {
348
+ hostConfig . HostId = Utility . GetDefaultHostId ( _settingsManager , ScriptConfig ) ;
349
+ }
350
+ if ( string . IsNullOrEmpty ( hostConfig . HostId ) )
351
+ {
352
+ throw new InvalidOperationException ( "An 'id' must be specified in the host configuration." ) ;
353
+ }
354
+
346
355
_debugModeFileWatcher = new AutoRecoveringFileSystemWatcher ( hostLogPath , ScriptConstants . DebugSentinelFileName ,
347
356
includeSubdirectories : false , changeTypes : WatcherChangeTypes . Created | WatcherChangeTypes . Changed ) ;
348
357
@@ -364,10 +373,6 @@ protected virtual void Initialize()
364
373
var bindingProviders = LoadBindingProviders ( ScriptConfig , hostConfigObject , TraceWriter , _startupLogger ) ;
365
374
ScriptConfig . BindingProviders = bindingProviders ;
366
375
367
- string message = string . Format ( CultureInfo . InvariantCulture , "Reading host configuration file '{0}'" , hostConfigFilePath ) ;
368
- TraceWriter . Info ( message ) ;
369
- _startupLogger ? . LogInformation ( message ) ;
370
-
371
376
if ( ScriptConfig . FileWatchingEnabled )
372
377
{
373
378
_fileEventSource = new FileWatcherEventSource ( EventManager , EventSources . ScriptFiles , ScriptConfig . RootScriptPath ) ;
0 commit comments