| # Gaudi Framework, version v25r0 |

Home |  | Generated: Mon Feb 17 2014

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
IssueLogger Class Reference

`#include <IssueLogger.h>`

Inheritance diagram for IssueLogger:
[legend]
Collaboration diagram for IssueLogger:
[legend]

## Public Member Functions
virtual StatusCode | initialize ()
virtual StatusCode | reinitialize ()
virtual StatusCode | finalize ()
| IssueLogger (const std::string &name, ISvcLocator *svc)
void | report (IssueSeverity::Level level, const std::string &msg, const std::string &origin)
void | report (const IssueSeverity &err)
Public Member Functions inherited from extends1< Service, IIssueLogger >
| extends1 (A1 a1, A2 a2, A3 a3)
| Templated constructor with 3 arguments.
| extends1 (A1 a1, A2 a2)
| Templated constructor with 2 arguments.
| extends1 (A1 a1)
| Templated constructor with 1 argument.
| extends1 ()
| Default constructor.
virtual void * | i_cast (const InterfaceID &tid) const
| Implementation of IInterface::i_cast.
virtual StatusCode | queryInterface (const InterfaceID &ti, void **pp)
| Implementation of IInterface::queryInterface.
virtual std::vector< std::string > | getInterfaceNames () const
| Implementation of IInterface::getInterfaceNames.
virtual | ~extends1 ()
| Virtual destructor.
Public Member Functions inherited from Service
virtual unsigned long | release ()
| Release Interface instance.
virtual const std::string & | name () const
| Retrieve name of the service.
virtual StatusCode | configure ()
virtual StatusCode | start ()
virtual StatusCode | stop ()
virtual StatusCode | terminate ()
virtual Gaudi::StateMachine::State | FSMState () const
virtual Gaudi::StateMachine::State | targetFSMState () const
virtual StatusCode | restart ()
virtual StatusCode | sysInitialize ()
| Initialize Service.
virtual StatusCode | sysStart ()
| Initialize Service.
virtual StatusCode | sysStop ()
| Initialize Service.
virtual StatusCode | sysFinalize ()
| Finalize Service.
virtual StatusCode | sysReinitialize ()
| Re-initialize the Service.
virtual StatusCode | sysRestart ()
| Re-initialize the Service.
virtual StatusCode | setProperty (const Property &p)
virtual StatusCode | setProperty (const std::string &s)
virtual StatusCode | setProperty (const std::string &n, const std::string &v)
virtual StatusCode | getProperty (Property *p) const
virtual const Property & | getProperty (const std::string &name) const
virtual StatusCode | getProperty (const std::string &n, std::string &v) const
virtual const std::vector < Property * > & | getProperties () const
template<class TYPE >
StatusCode | setProperty (const std::string &name, const TYPE &value)
| set the property form the value
| Service (const std::string &name, ISvcLocator *svcloc)
| Standard Constructor.
SmartIF< ISvcLocator > & | serviceLocator () const
| Retrieve pointer to service locator.
StatusCode | setProperties ()
| Method for setting declared properties to the values specified for the job.
template<class T >
StatusCode | service (const std::string &name, const T *&psvc, bool createIf=true) const
| Access a service by name, creating it if it doesn't already exist.
template<class T >
StatusCode | service (const std::string &name, T *&psvc, bool createIf=true) const
template<class T >
StatusCode | service (const std::string &svcType, const std::string &svcName, T *&psvc) const
| Access a service by name and type, creating it if it doesn't already exist.
template<class T >
Property * | declareProperty (const std::string &name, T &property, const std::string &doc="none") const
| Declare the named property.
Property * | declareRemoteProperty (const std::string &name, IProperty *rsvc, const std::string &rname="") const
| Declare remote named properties.
SmartIF< IAuditorSvc > & | auditorSvc () const
| The standard auditor service.May not be invoked before sysInitialize() has been invoked.
Public Member Functions inherited from CommonMessaging< implements3< IService, IProperty, IStateful > >
| CommonMessaging (const A1 &a1, const A2 &a2, const A3 &a3)
| Templated constructor with 3 arguments.
| CommonMessaging (const A1 &a1, const A2 &a2)
| Templated constructor with 2 arguments.
| CommonMessaging (const A1 &a1)
| Templated constructor with 1 argument.
| CommonMessaging ()
| Default constructor.
virtual | ~CommonMessaging ()
| Virtual destructor.
SmartIF< IMessageSvc > & | msgSvc () const
| The standard message service.
MsgStream & | msgStream () const
| Return an uninitialized MsgStream.
MsgStream & | msgStream (const MSG::Level level) const
| Predefined configurable message stream for the efficient printouts.
MsgStream & | always () const
| shortcut for the method msgStream(MSG::ALWAYS)
MsgStream & | fatal () const
| shortcut for the method msgStream(MSG::FATAL)
MsgStream & | err () const
| shortcut for the method msgStream(MSG::ERROR)
MsgStream & | error () const
| shortcut for the method msgStream(MSG::ERROR)
MsgStream & | warning () const
| shortcut for the method msgStream(MSG::WARNING)
MsgStream & | info () const
| shortcut for the method msgStream(MSG::INFO)
MsgStream & | debug () const
| shortcut for the method msgStream(MSG::DEBUG)
MsgStream & | verbose () const
| shortcut for the method msgStream(MSG::VERBOSE)
MsgStream & | msg () const
| shortcut for the method msgStream(MSG::INFO)
MSG::Level | msgLevel () const
| get the output level from the embedded MsgStream
bool | msgLevel (MSG::Level lvl) const
| get the output level from the embedded MsgStream
Public Member Functions inherited from extend_interfaces1< IIssueLogger >
virtual | ~extend_interfaces1 ()
| Virtual destructor.
Public Member Functions inherited from IIssueLogger
| DeclareInterfaceID (IIssueLogger, 2, 0)
| InterfaceID.
Public Member Functions inherited from IService
| DeclareInterfaceID (IService, 3, 0)
| InterfaceID.
virtual StatusCode | sysInitialize ()=0
| Initialize Service.
virtual StatusCode | sysStart ()=0
| Start Service.
virtual StatusCode | sysStop ()=0
| Stop Service.
virtual StatusCode | sysFinalize ()=0
| Finalize Service.
virtual StatusCode | sysReinitialize ()=0
| Re-initialize the Service.
virtual StatusCode | sysRestart ()=0
| Re-start the Service.
virtual StatusCode | configure ()=0
| Configuration (from OFFLINE to CONFIGURED).
virtual StatusCode | start ()=0
| Start (from INITIALIZED to RUNNING).
virtual StatusCode | stop ()=0
| Stop (from RUNNING to INITIALIZED).
virtual StatusCode | terminate ()=0
| Initialization (from CONFIGURED to OFFLINE).
virtual StatusCode | restart ()=0
| Initialization (from RUNNING to RUNNING, via INITIALIZED).
virtual Gaudi::StateMachine::State | FSMState () const =0
| Get the current state.
virtual Gaudi::StateMachine::State | targetFSMState () const =0
| When we are in the middle of a transition, get the state where the transition is leading us.
virtual | ~IService ()
| virtual destructor
Public Member Functions inherited from INamedInterface
| DeclareInterfaceID (INamedInterface, 1, 0)
| InterfaceID.
virtual const std::string & | name () const =0
| Retrieve the name of the instance.
virtual | ~INamedInterface ()
| Virtual destructor (always needed for abstract classes).
Public Member Functions inherited from IInterface
virtual unsigned long | addRef ()=0
| Increment the reference count of Interface instance.
virtual unsigned long | release ()=0
| Release Interface instance.
virtual unsigned long | refCount () const =0
| Current reference count.
virtual | ~IInterface ()
| Virtual destructor.

## Protected Member Functions
virtual | ~IssueLogger ()

## Private Member Functions
StatusCode | connect (const std::string &)
void | getTraceBack (std::string &stack)
MSG::Level | sevToMsg (IssueSeverity::Level &lev)
IssueSeverity::Level | msgToSev (MSG::Level &lev)
void | setupDefaultLogger ()
void | setupLevels (Property &prop)
void | setupStreams (Property &prop)

## Private Attributes
StringArrayProperty | m_outputfile
StringProperty | m_reportLevelS
StringProperty | m_traceLevelS
BooleanProperty | m_showTime
IssueSeverity::Level | m_reportLevel
IssueSeverity::Level | m_traceLevel
StreamLogger * | m_logger [IssueSeverity::NUM_LEVELS]
boost::function< void(const std::string &)> | m_log [IssueSeverity::NUM_LEVELS]
std::map< MSG::Level, IssueSeverity::Level > | m_msgSevMap
std::map< IssueSeverity::Level, MSG::Level > | m_sevMsgMap
std::map< IssueSeverity::Level, std::string > | m_levelTrans
std::map< std::string, IssueSeverity::Level > | m_levelSTrans

## Additional Inherited Members
Public Types inherited from extends1< Service, IIssueLogger >
typedef extends1 | base_class
| Typedef to this class.
typedef extend_interfaces1 < IIssueLogger > | extend_interfaces_base
| Typedef to the base of this class.
typedef extend_interfaces_base::ext_iids | interfaces
| MPL set of all the implemented interfaces.
Static Public Member Functions inherited from IInterface
static const InterfaceID & | interfaceID ()
| Return an instance of InterfaceID identifying the interface.
Protected Attributes inherited from Service
IntegerProperty | m_outputLevel
| Service output level.
Gaudi::StateMachine::State | m_state
| Service state.
Gaudi::StateMachine::State | m_targetState
| Service state.

## Detailed Description

Definition at line 15 of file IssueLogger.h.

## Constructor & Destructor Documentation

IssueLogger::IssueLogger | ( | const std::string & | name,
|  | ISvcLocator * | svc
| ) |  |

Definition at line 28 of file IssueLogger.cpp.

: base_class(name, svc) {
declareProperty ("Output", m_outputfile );
declareProperty ("ReportLevel", m_reportLevelS="WARNING");
declareProperty ("TracebackLevel", m_traceLevelS="ERROR");
declareProperty ("ShowTime", m_showTime=false);
m_reportLevelS.declareUpdateHandler(&IssueLogger::setupLevels,this);
m_traceLevelS.declareUpdateHandler(&IssueLogger::setupLevels,this);
m_outputfile.declareUpdateHandler(&IssueLogger::setupStreams,this);
m_reportLevel = IssueSeverity::WARNING;
m_traceLevel = IssueSeverity::ERROR;
for (int i=0; i<IssueSeverity::NUM_LEVELS; ++i) {
m_logger[i] = 0;
}
m_msgSevMap[MSG::NIL] = IssueSeverity::NIL;
m_msgSevMap[MSG::VERBOSE] = IssueSeverity::VERBOSE;
m_msgSevMap[MSG::DEBUG] = IssueSeverity::DEBUG;
m_msgSevMap[MSG::INFO] = IssueSeverity::INFO;
m_msgSevMap[MSG::WARNING] = IssueSeverity::WARNING;
m_msgSevMap[MSG::ERROR] = IssueSeverity::ERROR;
m_msgSevMap[MSG::FATAL] = IssueSeverity::FATAL;
m_msgSevMap[MSG::ALWAYS] = IssueSeverity::ALWAYS;
m_sevMsgMap[IssueSeverity::NIL] = MSG::NIL;
m_sevMsgMap[IssueSeverity::VERBOSE] = MSG::VERBOSE;
m_sevMsgMap[IssueSeverity::DEBUG] = MSG::DEBUG;
m_sevMsgMap[IssueSeverity::DEBUG1] = MSG::DEBUG;
m_sevMsgMap[IssueSeverity::DEBUG2] = MSG::DEBUG;
m_sevMsgMap[IssueSeverity::DEBUG3] = MSG::DEBUG;
m_sevMsgMap[IssueSeverity::INFO] = MSG::INFO;
m_sevMsgMap[IssueSeverity::WARNING] = MSG::WARNING;
m_sevMsgMap[IssueSeverity::RECOVERABLE] = MSG::ERROR;
m_sevMsgMap[IssueSeverity::ERROR] = MSG::ERROR;
m_sevMsgMap[IssueSeverity::FATAL] = MSG::FATAL;
m_sevMsgMap[IssueSeverity::ALWAYS] = MSG::ALWAYS;
m_levelTrans[IssueSeverity::VERBOSE] = "VERBOSE";
m_levelTrans[IssueSeverity::DEBUG] = "DEBUG";
m_levelTrans[IssueSeverity::DEBUG1] = "DEBUG1";
m_levelTrans[IssueSeverity::DEBUG2] = "DEBUG2";
m_levelTrans[IssueSeverity::DEBUG3] = "DEBUG3";
m_levelTrans[IssueSeverity::INFO] = "INFO";
m_levelTrans[IssueSeverity::WARNING] = "WARNING";
m_levelTrans[IssueSeverity::RECOVERABLE] = "RECOVERABLE";
m_levelTrans[IssueSeverity::ERROR] = "ERROR";
m_levelTrans[IssueSeverity::FATAL] = "FATAL";
m_levelTrans[IssueSeverity::ALWAYS] = "ALWAYS";
m_levelSTrans["VERBOSE"] = IssueSeverity::VERBOSE;
m_levelSTrans["DEBUG"] = IssueSeverity::DEBUG;
m_levelSTrans["DEBUG1"] = IssueSeverity::DEBUG1;
m_levelSTrans["DEBUG2"] = IssueSeverity::DEBUG2;
m_levelSTrans["DEBUG3"] = IssueSeverity::DEBUG3;
m_levelSTrans["INFO"] = IssueSeverity::INFO;
m_levelSTrans["WARNING"] = IssueSeverity::WARNING;
m_levelSTrans["RECOVERABLE"] = IssueSeverity::RECOVERABLE;
m_levelSTrans["ERROR"] = IssueSeverity::ERROR;
m_levelSTrans["FATAL"] = IssueSeverity::FATAL;
m_levelSTrans["ALWAYS"] = IssueSeverity::ALWAYS;
}

IssueLogger::~IssueLogger | ( |  | ) |
| protected virtual

Definition at line 98 of file IssueLogger.cpp.

{
}

## Member Function Documentation

StatusCode IssueLogger::connect | ( | const std::string & | ident | ) |
| private

Definition at line 157 of file IssueLogger.cpp.

{
MsgStream log ( msgSvc(), name() );
Tokenizer tok(true);
string::size_type loc = ident.find(" ");
// string stream = ident.substr(0,loc); // icc remark #177: variable "stream" was declared but never referenced
// typedef std::pair<std::string,std::string> Prop;
// std::vector<Prop> props;
string val,VAL,TAG,filename;
tok.analyse(ident.substr(loc+1,ident.length()), " ", "", "", "=", "'", "'");
for ( Tokenizer::Items::iterator i = tok.items().begin();
i != tok.items().end(); i++) {
const std::string& tag = (*i).tag();
TAG = tag;
toupper(TAG);
val = (*i).value();
VAL = val;
toupper(VAL);
IssueSeverity::Level level;
if (TAG == "DEBUG") {
level = IssueSeverity::DEBUG;
} else if ( TAG == "INFO") {
level = IssueSeverity::INFO;
} else if ( TAG == "WARNING") {
level = IssueSeverity::WARNING;
} else if ( TAG == "RECOVERABLE") {
level = IssueSeverity::RECOVERABLE;
} else if ( TAG == "ERROR") {
level = IssueSeverity::ERROR;
} else if ( TAG == "FATAL") {
level = IssueSeverity::FATAL;
} else {
log << MSG::ERROR << "Unknown output level \"" << TAG << "\""
<< endmsg;
continue;
}
if (m_logger[level] != 0) {
log << MSG::INFO << "closing stream " << m_logger[level]->name()
<< endmsg;
delete m_logger[level];
m_logger[level] = 0;
}
if (val == "MsgSvc") {
m_logger[level] = new StreamLogger(msgSvc(), m_sevMsgMap[level]);
m_log[level] =
boost::bind(&StreamLogger::WriteToMsgSvc, m_logger[level],
_1);
} else if (val == "STDERR") {
m_logger[level] = new StreamLogger(std::cerr);
m_log[level] =
boost::bind(&StreamLogger::WriteToStream, m_logger[level],
_1);
} else if (val == "STDOUT") {
m_logger[level] = new StreamLogger(std::cout);
m_log[level] =
boost::bind(&StreamLogger::WriteToStream, m_logger[level],
_1);
} else { // A file
try {
m_logger[level] = new StreamLogger(val.c_str());
}
catch (std::exception&) {
m_logger[level] = 0;
log << MSG::ERROR << "Unable to open file \"" << VAL
<< "\" for writing issues at level " << TAG << endmsg;
return StatusCode::FAILURE;
}
m_log[level] =
boost::bind(&StreamLogger::WriteToStream, m_logger[level], _1);
}
log << MSG::DEBUG << "Writing " << m_levelTrans[level]
<< " issues to " << m_logger[level]->name() << endmsg;
}
return StatusCode::SUCCESS;
}

StatusCode IssueLogger::finalize | ( |  | ) |
| virtual

Reimplemented from Service.

Definition at line 132 of file IssueLogger.cpp.

{
MsgStream log ( msgSvc(), name() );
log << MSG::DEBUG << "IssueLogger::finalize" << endmsg;
for (int i=0; i<IssueSeverity::NUM_LEVELS; ++i) {
IssueSeverity::Level j = IssueSeverity::Level (i);
delete m_logger[j];
}
return Service::finalize();
}

void IssueLogger::getTraceBack | ( | std::string & | stack | ) |
| private

Definition at line 148 of file IssueLogger.cpp.

{
const int depth = 30;
const int offset = 5;
System::backTrace(stack, depth, offset);
}

StatusCode IssueLogger::initialize | ( |  | ) |
| virtual

Reimplemented from Service.

Definition at line 105 of file IssueLogger.cpp.

{
StatusCode st = Service::initialize();
if (st.isFailure()) { return st; }
setupDefaultLogger();
return st;
}

IssueSeverity::Level IssueLogger::msgToSev | ( | MSG::Level & | lev | ) |
| private

StatusCode IssueLogger::reinitialize | ( |  | ) |
| virtual

Reimplemented from Service.

Definition at line 119 of file IssueLogger.cpp.

{
MsgStream log ( msgSvc(), name() );
log << MSG::WARNING << "reinitialize not implemented" << endmsg;
return StatusCode::SUCCESS;
}

void IssueLogger::report | ( | IssueSeverity::Level | level,
|  | const std::string & | msg,
|  | const std::string & | origin
| ) |  |
| virtual

Implements IIssueLogger.

Definition at line 246 of file IssueLogger.cpp.

{
if ( lev < m_reportLevel) return;
std::string msg = m_levelTrans[lev] + " " + org + " \"" + str + "\"";
if (m_showTime) {
msg += " [" + Gaudi::Time::current().format(true, "%H:%M:%S %Y/%m/%d %Z") +"]";
}
if (lev >= m_traceLevel) {
std::string stack;
getTraceBack(stack);
msg += "\n" + stack;
}
m_log[lev](msg);
}

void IssueLogger::report | ( | const IssueSeverity & | err | ) |
| virtual

Implements IIssueLogger.

Definition at line 274 of file IssueLogger.cpp.

{
report(err.getLevel(), err.getMsg(), err.getOrigin());
}

void IssueLogger::setupDefaultLogger | ( |  | ) |
| private

Definition at line 355 of file IssueLogger.cpp.

{
for (int i=1; i<IssueSeverity::NUM_LEVELS; ++i) {
if (m_logger[i] == 0) {
// default: dump to msgSvc
IssueSeverity::Level j = IssueSeverity::Level (i);
m_logger[j] = new StreamLogger(msgSvc(), m_sevMsgMap[j]);
m_log[j] = boost::bind(&StreamLogger::WriteToMsgSvc, m_logger[j],
_1);
MsgStream log ( msgSvc(), name() );
log << MSG::DEBUG << "Writing " << m_levelTrans[j]
<< " issues to " << m_logger[j]->name() << endmsg;
}
}
}

void IssueLogger::setupLevels | ( | Property & | prop | ) |
| private

Definition at line 283 of file IssueLogger.cpp.

{
StringProperty *sap = dynamic_cast<StringProperty*> (&prop);
if (sap == 0) {
MsgStream log ( msgSvc(), name() );
log << MSG::ERROR << "Could not convert " << prop.name()
<< "to a StringProperty (which it should be!)" << endmsg;
return;
}
std::string val = sap->value();
if (prop.name() == "ReportLevel") {
if (m_levelSTrans.find(val) == m_levelSTrans.end()) {
MsgStream log ( msgSvc(), name() );
log << MSG::ERROR
<< "Option ReportLevel: unknown Issue Severity level \""
<< val << "\". Setting it WARNING" << endmsg;
m_reportLevel = IssueSeverity::WARNING;
return;
} else {
m_reportLevel = m_levelSTrans[m_reportLevelS];
}
} else if (prop.name() == "TracebackLevel") {
if (m_levelSTrans.find(val) == m_levelSTrans.end()) {
MsgStream log ( msgSvc(), name() );
log << MSG::ERROR
<< "Option TracebackLevel: unknown Issue Severity level \""
<< val << "\". Setting it to ERROR" << endmsg;
m_traceLevel = IssueSeverity::ERROR;
return;
} else {
m_traceLevel = m_levelSTrans[m_traceLevelS];
}
} else {
MsgStream log ( msgSvc(), name() );
log << MSG::ERROR << "setting up unknown property \"" << prop.name()
<< "\"" << endmsg;
return;
}
}

void IssueLogger::setupStreams | ( | Property & | prop | ) |
| private

Definition at line 330 of file IssueLogger.cpp.

{
StringArrayProperty *sap = dynamic_cast<StringArrayProperty*>( &prop );
if (sap == 0) {
MsgStream log ( msgSvc(), name() );
log << MSG::ERROR << "Could not convert " << prop.name()
<< "to a StringArrayProperty (which it should be!)" << endmsg;
return;
}
vector<string>::const_iterator itr;
for (itr = sap->value().begin(); itr != sap->value().end(); ++itr) {
if (connect(*itr).isFailure()) {
MsgStream log ( msgSvc(), name() );
log << MSG::ERROR << "Could not setup stream " << *itr << endmsg;
}
}
return;
}

MSG::Level IssueLogger::sevToMsg | ( | IssueSeverity::Level & | lev | ) |
| private

## Member Data Documentation

std::map<std::string, IssueSeverity::Level> IssueLogger::m_levelSTrans
| private

Definition at line 47 of file IssueLogger.h.

std::map<IssueSeverity::Level, std::string> IssueLogger::m_levelTrans
| private

Definition at line 46 of file IssueLogger.h.

boost::function<void (const std::string&)> IssueLogger::m_log[IssueSeverity::NUM_LEVELS]
| private

Definition at line 42 of file IssueLogger.h.

StreamLogger* IssueLogger::m_logger[IssueSeverity::NUM_LEVELS]
| private

Definition at line 41 of file IssueLogger.h.

std::map<MSG::Level, IssueSeverity::Level> IssueLogger::m_msgSevMap
| private

Definition at line 44 of file IssueLogger.h.

StringArrayProperty IssueLogger::m_outputfile
| private

Definition at line 35 of file IssueLogger.h.

IssueSeverity::Level IssueLogger::m_reportLevel
| private

Definition at line 39 of file IssueLogger.h.

StringProperty IssueLogger::m_reportLevelS
| private

Definition at line 36 of file IssueLogger.h.

std::map<IssueSeverity::Level, MSG::Level> IssueLogger::m_sevMsgMap
| private

Definition at line 45 of file IssueLogger.h.

BooleanProperty IssueLogger::m_showTime
| private

Definition at line 37 of file IssueLogger.h.

IssueSeverity::Level IssueLogger::m_traceLevel
| private

Definition at line 39 of file IssueLogger.h.

StringProperty IssueLogger::m_traceLevelS
| private

Definition at line 36 of file IssueLogger.h.

The documentation for this class was generated from the following files:

- /afs/cern.ch/sw/Gaudi/releases/GAUDI/GAUDI_v25r0/GaudiMonitor/src/IssueLogger.h
- /afs/cern.ch/sw/Gaudi/releases/GAUDI/GAUDI_v25r0/GaudiMonitor/src/IssueLogger.cpp