Ignore:
Timestamp:
01/23/15 16:18:43 (9 years ago)
Author:
rlacroix
Message:

Backport r523 into the stable branch.

Improve the message error handling by mimicking the behavior of the info/report logs.

Output the error messages to the standart error message until the context is correctly initialized. Then, output the error messages to a file if the user has set "print_file" parameter to "true".

  • Fix: Errors that occured before MPI was initialized (e.g. during the config file parsing) caused a MPI error on top of the original error.
  • Fix: The error file could sometimes be misnamed if the error happened before the context was completely known.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • XIOS/branchs/xios-1.0/src/exception.cpp

    r501 r548  
    66#include "server.hpp" 
    77#include "cxios.hpp" 
     8#include "log.hpp" 
    89 
    910namespace xios 
     
    3435#else 
    3536     { 
    36       int numDigit = 0; 
    37       int size = 0; 
    38       MPI_Comm_size(CXios::globalComm, &size); 
    39       while (size) 
    40       { 
    41         size /= 10; 
    42         ++numDigit; 
    43       } 
    44  
    45       StdOFStream fileStream; 
    46       StdStringStream fileNameErr; 
    47       std::streambuf* psbuf; 
    48       if (CXios::isServerSide) 
    49         fileNameErr << CXios::serverFile << "_" << std::setfill('0') 
    50                     << std::setw(numDigit) << CServer::getRank() << ".err"; 
    51       else 
    52         fileNameErr << CXios::clientFile << "_" << std::setfill('0') 
    53                     << std::setw(numDigit) << CClient::getRank() << ".err"; 
    54  
    55  
    56       fileStream.open(fileNameErr.str().c_str(), std::ofstream::out); 
    57       psbuf = fileStream.rdbuf(); 
    58       std::cerr.rdbuf(psbuf); 
    59       std::cerr << this->getMessage() << std::endl; 
    60       fileStream.close(); 
     37      error << this->getMessage() << std::endl; 
    6138      abort(); 
    6239      } 
    63  
    6440#endif 
    6541   } 
Note: See TracChangeset for help on using the changeset viewer.