Gaudi Framework, version v25r0

Home   Generated: Mon Feb 17 2014
 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"
5 
7 
8 AlgErrorAuditor::AlgErrorAuditor(const std::string& name, ISvcLocator* pSvcLocator)
9  : Auditor(name, pSvcLocator), m_error(0), m_fatal(0) {
10 
11  declareProperty( "Abort", m_abort = false,
12  "Abort job upon illegal Algorithm return code");
13  declareProperty( "Throw", m_throw = false,
14  "Throw GaudiException upon illegal Algorithm return code");
15 }
16 
18 }
19 
20 
21 void
23  m_error = msgSvc()->messageCount(MSG::ERROR);
24  m_fatal = msgSvc()->messageCount(MSG::FATAL);
25 }
26 
29 
30  if (m_abort && m_throw) {
31  MsgStream log(msgSvc(), name());
32  log << MSG::INFO << "Both \"Throw\" and \"Abort\" options have been set."
33  << " Abort takes precedence." << endmsg;
34  }
35 
36  return StatusCode::SUCCESS;
37 }
38 
39 
40 void
42 
43  bool fail(false);
44  if (msgSvc()->messageCount(MSG::ERROR) != m_error && ! sc.isRecoverable() ) {
46  os << "Illegal Return Code: Algorithm " << alg->name()
47  << " reported an ERROR, but returned a StatusCode \"" << sc << "\"";
48  os << std::endl << "Error policy described in "
49  << "https://twiki.cern.ch/twiki/bin/view/Atlas/ReportingErrors";
50 
51  MsgStream log(msgSvc(), name());
52  log << MSG::ERROR << os.str() << endmsg;
53  incrMap(alg->name(), 0);
54  fail = true;
55 
56  if (m_throw && ! m_abort) {
57  throw GaudiException(os.str(),"AlgErrorAuditor",0);
58  }
59  }
60 
61  if (msgSvc()->messageCount(MSG::FATAL) != m_fatal &&
62  sc != StatusCode::FAILURE ) {
64  os << "Illegal Return Code: Algorithm " << alg->name()
65  << " reported a FATAL, but returned a StatusCode \"" << sc << "\"";
66  os << std::endl << "Error policy described in "
67  << "https://twiki.cern.ch/twiki/bin/view/Atlas/ReportingErrors";
68 
69  MsgStream log(msgSvc(), name());
70  log << MSG::ERROR << os.str() << endmsg;
71  incrMap(alg->name(), 1);
72  fail = true;
73 
74  if (m_throw && ! m_abort) {
75  throw GaudiException(os.str(),"AlgErrorAuditor",0);
76  }
77 
78  }
79 
80  if (fail && m_abort) {
81  abort();
82  }
83 
84 }
85 
88 
89 
91  if (m_algMap[0].size() != 0) {
92  MsgStream log(msgSvc(), name());
93  log << MSG::INFO << "Found " << m_algMap[0].size()
94  << " instances where an Algorithm::execute() produced an ERROR "
95  << "but returned a SUCCESS:" << std::endl;
96 
97  for (itr = m_algMap[0].begin(); itr != m_algMap[0].end(); ++itr) {
98  log << itr->first << ": " << itr->second << std::endl;
99  }
100 
101  log << endmsg;
102  }
103 
104  if (m_algMap[1].size() != 0) {
105  MsgStream log(msgSvc(), name());
106  log << MSG::INFO << "Found " << m_algMap[1].size()
107  << " instances where an Algorithm::execute() produced a FATAL "
108  << "but returned a SUCCESS:" << std::endl;
109 
110  for (itr = m_algMap[1].begin(); itr != m_algMap[1].end(); ++itr) {
111  log << itr->first << ": " << itr->second << std::endl;
112  }
113 
114  log << endmsg;
115  }
116 
117 
118  return StatusCode::SUCCESS;
119 
120 }
121 
122 void
125  if ( (itr=m_algMap[level].find(alg)) != m_algMap[level].end()) {
126  itr->second++;
127  } else {
129  }
130 }
131 

Generated at Mon Feb 17 2014 14:37:39 for Gaudi Framework, version v25r0 by Doxygen version 1.8.2 written by Dimitri van Heesch, © 1997-2004