61 log4cpp::Appender * appender;
62 appender =
new log4cpp::OstreamAppender(
"default", &cout);
63 const char* layoutenv = gSystem->Getenv(
"GMSGLAYOUT");
64 std::string layoutstr = (layoutenv) ?
string(layoutenv) :
"BASIC";
65 if ( layoutstr ==
"SIMPLE" )
66 appender->setLayout(
new log4cpp::SimpleLayout());
68 appender->setLayout(
new log4cpp::BasicLayout());
71 log4cpp::Category & MSG = log4cpp::Category::getRoot();
73 MSG.setAdditivity(
false);
74 MSG.addAppender(appender);
124 if(filenames.size()==0)
return false;
127 if(filename_vec.size() == 0)
return false;
129 vector<string>::const_iterator filename_iter;
130 for(filename_iter = filename_vec.begin();
131 filename_iter != filename_vec.end(); ++filename_iter)
137 <<
"Reading msg stream priorities from XML file: " << filename;
139 xmlDocPtr xml_doc = xmlParseFile(filename.c_str());
142 <<
"XML file could not be parsed! [file: " << filename <<
"]";
146 xmlNodePtr xml_root = xmlDocGetRootElement(xml_doc);
149 <<
"XML doc. has null root element! [file: " << filename <<
"]";
154 if( xmlStrcmp(xml_root->name, (
const xmlChar *)
"messenger_config") ) {
156 <<
"XML doc. has invalid root element! [file: " << filename <<
"]";
157 xmlFreeNode(xml_root);
162 xmlNodePtr xml_msgp = xml_root->xmlChildrenNode;
165 while (xml_msgp != NULL) {
168 if( (!xmlStrcmp(xml_msgp->name, (
const xmlChar *)
"priority")) ) {
174 xml_doc, xml_msgp->xmlChildrenNode, 1));
178 <<
"Set priority level: " << setfill(
'.')
179 << setw(24) << msgstream <<
" --> " << priority;
181 xml_msgp = xml_msgp->next;
185 xmlFreeNode(xml_msgp);
194 if ( p.find(
"DEBUG") != string::npos )
return log4cpp::Priority::DEBUG;
195 if ( p.find(
"INFO") != string::npos )
return log4cpp::Priority::INFO;
196 if ( p.find(
"NOTICE") != string::npos )
return log4cpp::Priority::NOTICE;
197 if ( p.find(
"WARN") != string::npos )
return log4cpp::Priority::WARN;
198 if ( p.find(
"ERROR") != string::npos )
return log4cpp::Priority::ERROR;
199 if ( p.find(
"CRIT") != string::npos )
return log4cpp::Priority::CRIT;
200 if ( p.find(
"ALERT") != string::npos )
return log4cpp::Priority::ALERT;
201 if ( p.find(
"FATAL") != string::npos )
return log4cpp::Priority::FATAL;
204 <<
"Unknown priority = " << p <<
" - Setting to INFO";
205 return log4cpp::Priority::INFO;
#define SLOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a short string (using the FUNCTION and...