mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-01-16 12:41:54 -06:00
FlowMain: make sure to always print exception messages to the terminal
this patch only uses OpmLog if it is set up properly, else it uses std::cout. the reason why this is needed is that there's a chicken-and-egg problem: exceptions which are thrown before the logging system has been initialized -- most prominently while parsing the deck -- cause the simulator to silently abort without any user notification which can be very confusing. On the other hand, initializing the logging system requires a fully initialized EclipseState object, i.e. currently to initialze the logging system the deck must be parsed and in order to print the exceptions thrown while parsing the deck one needs the logging system. v2: only prevent using the logging system if has not been set up. thanks to [at]blattms for the suggestion!
This commit is contained in:
parent
09d4b89c60
commit
edbfdb5ef3
@ -166,7 +166,14 @@ namespace Opm
|
||||
|
||||
if( output_cout_ )
|
||||
{
|
||||
OpmLog::error(message.str());
|
||||
// in some cases exceptions are thrown before the logging system is set
|
||||
// up.
|
||||
if (OpmLog::hasBackend("STREAMLOG")) {
|
||||
OpmLog::error(message.str());
|
||||
}
|
||||
else {
|
||||
std::cout << message.str() << "\n";
|
||||
}
|
||||
}
|
||||
|
||||
return EXIT_FAILURE;
|
||||
|
Loading…
Reference in New Issue
Block a user