Gaudi Framework, version v23r5

Home   Generated: Wed Nov 28 2012
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
AlgErrorAuditor.cpp
Go to the documentation of this file.
1 #include "AlgErrorAuditor.h"
6 
8 
9 AlgErrorAuditor::AlgErrorAuditor(const std::string& name, ISvcLocator* pSvcLocator)
10  : Auditor(name, pSvcLocator), m_error(0), m_fatal(0) {
11 
12  declareProperty( "Abort", m_abort = false,
13  "Abort job upon illegal Algorithm return code");
14  declareProperty( "Throw", m_throw = false,
15  "Throw GaudiException upon illegal Algorithm return code");
16 }
17 
19 }
20 
21 
22 void
24  m_error = msgSvc()->messageCount(MSG::ERROR);
25  m_fatal = msgSvc()->messageCount(MSG::FATAL);
26 }
27 
30 
31  if (m_abort && m_throw) {
32  MsgStream log(msgSvc(), name());
33  log << MSG::INFO << "Both \"Throw\" and \"Abort\" options have been set."
34  << " Abort takes precedence." << endmsg;
35  }
36 
37  return StatusCode::SUCCESS;
38 }
39 
40 
41 void
43 
44  bool fail(false);
45  if (msgSvc()->messageCount(MSG::ERROR) != m_error && ! sc.isRecoverable() ) {
47  os << "Illegal Return Code: Algorithm " << alg->name()
48  << " reported an ERROR, but returned a StatusCode \"" << sc << "\"";
49  os << std::endl << "Error policy described in "
50  << "https://twiki.cern.ch/twiki/bin/view/Atlas/ReportingErrors";
51 
52  MsgStream log(msgSvc(), name());
53  log << MSG::ERROR << os.str() << endmsg;
54  incrMap(alg->name(), 0);
55  fail = true;
56 
57  if (m_throw && ! m_abort) {
58  throw GaudiException(os.str(),"AlgErrorAuditor",0);
59  }
60  }
61 
62  if (msgSvc()->messageCount(MSG::FATAL) != m_fatal &&
63  sc != StatusCode::FAILURE ) {
65  os << "Illegal Return Code: Algorithm " << alg->name()
66  << " reported a FATAL, but returned a StatusCode \"" << sc << "\"";
67  os << std::endl << "Error policy described in "
68  << "https://twiki.cern.ch/twiki/bin/view/Atlas/ReportingErrors";
69 
70  MsgStream log(msgSvc(), name());
71  log << MSG::ERROR << os.str() << endmsg;
72  incrMap(alg->name(), 1);
73  fail = true;
74 
75  if (m_throw && ! m_abort) {
76  throw GaudiException(os.str(),"AlgErrorAuditor",0);
77  }
78 
79  }
80 
81  if (fail && m_abort) {
82  abort();
83  }
84 
85 }
86 
89 
90 
92  if (m_algMap[0].size() != 0) {
93  MsgStream log(msgSvc(), name());
94  log << MSG::INFO << "Found " << m_algMap[0].size()
95  << " instances where an Algorithm::execute() produced an ERROR "
96  << "but returned a SUCCESS:" << std::endl;
97 
98  for (itr = m_algMap[0].begin(); itr != m_algMap[0].end(); ++itr) {
99  log << itr->first << ": " << itr->second << std::endl;
100  }
101 
102  log << endmsg;
103  }
104 
105  if (m_algMap[1].size() != 0) {
106  MsgStream log(msgSvc(), name());
107  log << MSG::INFO << "Found " << m_algMap[1].size()
108  << " instances where an Algorithm::execute() produced a FATAL "
109  << "but returned a SUCCESS:" << std::endl;
110 
111  for (itr = m_algMap[1].begin(); itr != m_algMap[1].end(); ++itr) {
112  log << itr->first << ": " << itr->second << std::endl;
113  }
114 
115  log << endmsg;
116  }
117 
118 
119  return StatusCode::SUCCESS;
120 
121 }
122 
123 void
126  if ( (itr=m_algMap[level].find(alg)) != m_algMap[level].end()) {
127  itr->second++;
128  } else {
130  }
131 }
132 

Generated at Wed Nov 28 2012 12:17:10 for Gaudi Framework, version v23r5 by Doxygen version 1.8.2 written by Dimitri van Heesch, © 1997-2004