@@ -352,8 +352,9 @@ void OREApp::initFromParams() {
352352 inputs_->loadParameters ();
353353 outputs_ = QuantLib::ext::make_shared<OutputParameters>(params_);
354354 CONSOLE (" OK" );
355-
355+
356356 Settings::instance ().evaluationDate () = inputs_->asof ();
357+ LOG (" initFromParameters done, requested analytics:" << to_string (inputs_->analytics ()));
357358}
358359
359360void OREApp::initFromInputs () {
@@ -365,7 +366,9 @@ void OREApp::initFromInputs() {
365366 }
366367
367368 outputPath_ = inputs_->resultsPath ().string ();
368- setupLog (outputPath_, logFile_, logMask_, logRootPath_);
369+ setupLog (outputPath_, logFile_, logMask_, logRootPath_, progressLogFile_, progressLogRotationSize_, progressLogToConsole_,
370+ structuredLogFile_, structuredLogRotationSize_);
371+ LOG (" initFromInputs done, requested analytics:" << to_string (inputs_->analytics ()));
369372}
370373
371374OREApp::~OREApp () {
@@ -375,24 +378,27 @@ OREApp::~OREApp() {
375378
376379void OREApp::run () {
377380
378- // only one thread at a time should call run
381+ // Only one thread at a time should call run
379382 static std::mutex _s_mutex;
380383 std::lock_guard<std::mutex> lock (_s_mutex);
381384
382- // clean up after finishing the run
383- CleanUpThreadLocalSingletons cleanupThreadLocalSingletons;
384- CleanUpThreadGlobalSingletons cleanupThreadGloablSingletons;
385- CleanUpLogSingleton cleanupLogSingleton (true , true );
385+ // Clean start, but leave Singletons intact after run is completed
386+ {
387+ CleanUpThreadLocalSingletons cleanupThreadLocalSingletons;
388+ CleanUpThreadGlobalSingletons cleanupThreadGloablSingletons;
389+ CleanUpLogSingleton cleanupLogSingleton (true , true );
390+ }
386391
387- if (inputs_ == nullptr )
388- initFromParams ();
389- else if (params_ == nullptr )
392+ // Use inputs when available, otherwise try params
393+ if (inputs_ != nullptr )
390394 initFromInputs ();
395+ else if (params_ != nullptr )
396+ initFromParams ();
391397 else {
392398 ALOG (" both inputs are empty" );
393- return ;
399+ return ;
394400 }
395-
401+
396402 runTimer_.start ();
397403
398404 try {
@@ -417,22 +423,25 @@ void OREApp::run() {
417423void OREApp::run (const std::vector<std::string>& marketData,
418424 const std::vector<std::string>& fixingData) {
419425
420- // only one thread at a time should call run
426+ // Only one thread at a time should call run
421427 static std::mutex _s_mutex;
422428 std::lock_guard<std::mutex> lock (_s_mutex);
423429
424- // clean up after finishing the run
425- CleanUpThreadLocalSingletons cleanupThreadLocalSingletons;
426- CleanUpThreadGlobalSingletons cleanupThreadGloablSingletons;
427- CleanUpLogSingleton cleanupLogSingleton (true , true );
430+ // Clean start, but leave Singletons intact after run is completed
431+ {
432+ CleanUpThreadLocalSingletons cleanupThreadLocalSingletons;
433+ CleanUpThreadGlobalSingletons cleanupThreadGloablSingletons;
434+ CleanUpLogSingleton cleanupLogSingleton (true , true );
435+ }
428436
429- if (inputs_ == nullptr )
430- initFromParams ();
431- else if (params_ == nullptr )
437+ // Use inputs when available, otherwise try params
438+ if (inputs_ != nullptr )
432439 initFromInputs ();
440+ else if (params_ != nullptr )
441+ initFromParams ();
433442 else {
434443 ALOG (" both inputs are empty" );
435- return ;
444+ return ;
436445 }
437446
438447 runTimer_.start ();
0 commit comments