224 , clean_slate_configuration(
true )
226 , singleThread (queue.
get() == 0)
255 m_queue->consume(opcode, operand);
273 assert( operand == 0 );
288 <<
" cms::Exceptions, text = \n"
293 cerr <<
"MessageLogger will no longer be processing "
294 <<
"messages due to errors (entering purge mode).\n";
300 std::cerr <<
"MessageLoggerScribe caught an unknown exception and "
301 <<
"will no longer be processing "
302 <<
"messages. (entering purge mode)\n";
310 job_pset_p.reset(static_cast<ParameterSet *>(operand));
316 job_pset_p.reset(static_cast<ParameterSet *>(h_p->
p));
317 boost::mutex::scoped_lock sl(h_p->
m);
328 (*ep) <<
"\n and another exception: \n" << e.
what();
343 extern_dests.push_back( static_cast<NamedDestination *>(operand) );
348 std::cerr <<
"MessageLoggerScribe caught a cms::Exception "
349 <<
"during extern dest configuration:\n"
351 <<
"This is a serious problem, and the extern dest "
352 <<
"will not be produced.\n"
353 <<
"However, the rest of the logger continues to run.\n";
357 std::cerr <<
"MessageLoggerScribe caught unkonwn exception type\n"
358 <<
"during extern dest configuration. "
359 <<
"This is a serious problem, and the extern dest "
360 <<
"will not be produced.\n"
361 <<
"The rest of the logger will attempt to continue to run.\n";
366 assert( operand == 0 );
372 std::cerr <<
"MessageLoggerScribe caught exception "
373 <<
"during summarize:\n"
378 std::cerr <<
"MessageLoggerScribe caught unkonwn exception type "
379 <<
"during summarize. (Ignored)\n";
384 std::string* jobReportOption_p =
385 static_cast<std::string*
>(operand);
391 std::cerr <<
"MessageLoggerScribe caught a cms::Exception "
392 <<
"during processing of --jobReport option:\n"
394 <<
"This likely will affect or prevent the job report.\n"
395 <<
"However, the rest of the logger continues to run.\n";
399 std::cerr <<
"MessageLoggerScribe caught unkonwn exception type\n"
400 <<
"during processing of --jobReport option.\n"
401 <<
"This likely will affect or prevent the job report.\n"
402 <<
"However, the rest of the logger continues to run.\n";
404 delete jobReportOption_p;
410 std::string* jobMode_p =
411 static_cast<std::string*
>(operand);
423 assert( operand == 0 );
431 job_pset_p.reset(static_cast<ParameterSet *>(h_p->
p));
432 boost::mutex::scoped_lock sl(h_p->
m);
439 static_cast<std::string*
>(operand);
446 std::map<std::string, double> * smp =
447 static_cast<std::map<std::string, double> *
>(operand);
453 boost::mutex::scoped_lock sl(h_p->
m);
454 std::map<std::string, double> * smp =
455 static_cast<std::map<std::string, double> *
>(h_p->
p);
473 for (
unsigned int icat = 0; icat < categories.size(); ++icat) {
474 errorobj_p->
setID(categories[icat]);
475 (*errorlog_p)( *errorobj_p );
487 String preconfiguration_message
488 = getAparameter<String>
489 (*
job_pset_p,
"generate_preconfiguration_message", empty_String);
490 if (preconfiguration_message != empty_String) {
496 LogError (
"preconfiguration") << preconfiguration_message;
500 m_queue->consume(opcode, operand);
510 <<
"The message logger has been configured multiple times";
529 static const int NO_VALUE_SET = -45654;
535 const std::string COMMON_DEFAULT_THRESHOLD =
"INFO";
536 const int COMMON_DEFAULT_LIMIT = NO_VALUE_SET;
537 const int COMMON_DEFAULT_INTERVAL = NO_VALUE_SET;
538 const int COMMON_DEFAULT_TIMESPAN = NO_VALUE_SET;
540 char const* severity_array[] = {
"WARNING",
"INFO",
"ERROR",
"DEBUG"};
541 vString const severities(severity_array+0, severity_array+4);
545 = getAparameter<vString>(*
job_pset_p,
"categories", empty_vString);
551 = getAparameter<vString>(*
job_pset_p,
"messageIDs", empty_vString);
554 copy_all( messageIDs, std::back_inserter(categories) );
562 copy_all( hardcats, std::back_inserter(categories) );
567 = getAparameter<String>(*
job_pset_p,
"threshold", empty_String);
573 = getAparameter<PSet>(*
job_pset_p,
"default", empty_PSet);
575 = getAparameter<int>(default_pset,
"limit", COMMON_DEFAULT_LIMIT);
577 = getAparameter<int>(default_pset,
"reportEvery", COMMON_DEFAULT_INTERVAL);
580 = getAparameter<int>(default_pset,
"timespan", COMMON_DEFAULT_TIMESPAN);
583 String default_pset_threshold
584 = getAparameter<String>(default_pset,
"threshold", default_threshold);
592 = getAparameter<bool>(dest_pset,
"placeholder",
false);
593 if (is_placeholder)
return;
596 PSet dest_default_pset
597 = getAparameter<PSet>(dest_pset,
"default", empty_PSet);
598 int dest_default_limit
599 = getAparameter<int>(dest_default_pset,
"limit", default_limit);
600 int dest_default_interval
601 = getAparameter<int>(dest_default_pset,
"reportEvery", default_interval);
603 int dest_default_timespan
604 = getAparameter<int>(dest_default_pset,
"timespan", default_timespan);
606 if ( dest_default_limit != NO_VALUE_SET ) {
607 if ( dest_default_limit < 0 ) dest_default_limit = 2000000000;
608 dest_ctrl.
setLimit(
"*", dest_default_limit );
610 if ( dest_default_interval != NO_VALUE_SET ) {
611 dest_ctrl.
setInterval(
"*", dest_default_interval );
613 if ( dest_default_timespan != NO_VALUE_SET ) {
614 if ( dest_default_timespan < 0 ) dest_default_timespan = 2000000000;
615 dest_ctrl.
setTimespan(
"*", dest_default_timespan );
620 = getAparameter<String>(dest_pset,
"threshold", default_threshold);
621 if (dest_threshold == empty_String) {
622 dest_threshold = default_threshold;
624 if (dest_threshold == empty_String) {
625 dest_threshold = default_pset_threshold;
627 if (dest_threshold == empty_String) {
630 if (dest_threshold == empty_String) dest_threshold = COMMON_DEFAULT_THRESHOLD;
642 for( vString::const_iterator id_it = categories.begin()
643 ; id_it != categories.end()
648 PSet default_category_pset
649 = getAparameter<PSet>(default_pset, msgID, empty_PSet);
651 = getAparameter<PSet>(dest_pset, msgID, default_category_pset);
653 int category_default_limit
654 = getAparameter<int>(default_category_pset,
"limit", NO_VALUE_SET);
656 = getAparameter<int>(category_pset,
"limit", category_default_limit);
657 if (limit == NO_VALUE_SET) limit = dest_default_limit;
659 int category_default_interval
660 = getAparameter<int>(default_category_pset,
"reportEvery", NO_VALUE_SET);
662 = getAparameter<int>(category_pset,
"reportEvery",category_default_interval);
663 if (interval == NO_VALUE_SET) interval = dest_default_interval;
665 int category_default_timespan
666 = getAparameter<int>(default_category_pset,
"timespan", NO_VALUE_SET);
668 = getAparameter<int>(category_pset,
"timespan", category_default_timespan);
669 if (timespan == NO_VALUE_SET) timespan = dest_default_timespan;
673 if ( limit == NO_VALUE_SET ) {
676 if ( interval == NO_VALUE_SET ) {
679 if ( timespan == NO_VALUE_SET ) {
683 if( limit != NO_VALUE_SET ) {
684 if ( limit < 0 ) limit = 2000000000;
687 if( interval != NO_VALUE_SET ) {
690 if( timespan != NO_VALUE_SET ) {
691 if ( timespan < 0 ) timespan = 2000000000;
698 for( vString::const_iterator sev_it = severities.begin()
699 ; sev_it != severities.end()
705 PSet default_sev_pset
706 = getAparameter<PSet>(default_pset, sevID, empty_PSet);
708 = getAparameter<PSet>(dest_pset, sevID, default_sev_pset);
710 int limit = getAparameter<int>(sev_pset,
"limit", NO_VALUE_SET);
711 if ( limit == NO_VALUE_SET ) {
714 if( limit != NO_VALUE_SET ) {
715 if (limit < 0) limit = 2000000000;
716 dest_ctrl.
setLimit(severity, limit );
718 int interval = getAparameter<int>(sev_pset,
"reportEvery", NO_VALUE_SET);
719 if ( interval == NO_VALUE_SET ) {
722 if( interval != NO_VALUE_SET ) dest_ctrl.
setInterval(severity, interval);
724 int timespan = getAparameter<int>(sev_pset,
"timespan", NO_VALUE_SET);
725 if ( timespan == NO_VALUE_SET ) {
728 if( timespan != NO_VALUE_SET ) {
729 if (timespan < 0) timespan = 2000000000;
735 bool noLineBreaks_default
736 = getAparameter<bool> (default_pset,
"noLineBreaks",
false);
739 = getAparameter<bool> (dest_pset,
"noLineBreaks", noLineBreaks_default);
746 = getAparameter<int> (default_pset,
"lineLength", lenDef);
748 int lineLen = getAparameter<int> (dest_pset,
"lineLength", lineLen_default);
749 if (lineLen != lenDef) {
755 bool suppressTime_default
756 = getAparameter<bool> (default_pset,
"noTimeStamps",
false);
758 = getAparameter<bool> (dest_pset,
"noTimeStamps", suppressTime_default);
772 int FwkJob_limit = 10000000;
773 dest_ctrl.
setLimit(msgID, FwkJob_limit);
788 bool jobReportExists =
false;
789 bool enableJobReports =
false;
790 #ifdef DEFINE_THIS_TO_MAKE_REPORTS_THE_DEFAULT
791 enableJobReports =
true;
795 if (!enableJobReports)
return;
806 = getAparameter<vString>(*
job_pset_p,
"fwkJobReports", empty_vString);
810 if (fwkJobReports.empty()) {
815 for( vString::const_iterator it = fwkJobReports.begin()
816 ; it != fwkJobReports.end()
824 PSet fjr_pset = getAparameter<PSet>(*
job_pset_p, psetname, empty_PSet);
826 = getAparameter<bool>(fjr_pset,
"placeholder",
false);
827 if (is_placeholder)
continue;
832 = getAparameter<String>(fjr_pset,
"filename", empty_String);
833 if (explicit_filename != empty_String) filename = explicit_filename;
835 = getAparameter<String>(fjr_pset,
"extension", empty_String);
836 if (explicit_extension != empty_String) {
837 if (explicit_extension[0] ==
'.') {
838 filename += explicit_extension;
840 filename = filename +
"." + explicit_extension;
845 std::string actual_filename =
filename;
847 if ( filename.find(
'.') == npos ) {
848 actual_filename +=
".xml";
855 <<
"Duplicate name for a MessageLogger Framework Job Report Destination: "
860 <<
"Duplicate name for a MessageLogger Framework Job Report Destination: "
862 <<
"\n" <<
"Only original configuration instructions are used";
867 jobReportExists =
true;
870 boost::shared_ptr<std::ofstream> os_sp(
new std::ofstream(actual_filename.c_str()));
874 stream_ps[actual_filename] = os_sp.get();
890 boost::shared_ptr<std::ofstream> os_sp(
new std::ofstream(actual_filename.c_str()));
894 stream_ps[actual_filename] = os_sp.get();
915 = getAparameter<vString>(*
job_pset_p,
"destinations", empty_vString);
919 if (destinations.empty()) {
924 if( ! destinations.empty() )
928 for( vString::const_iterator it = destinations.begin()
929 ; it != destinations.end()
937 PSet dest_pset = getAparameter<PSet>(*
job_pset_p, psetname, empty_PSet);
939 = getAparameter<bool>(dest_pset,
"placeholder",
false);
940 if (is_placeholder)
continue;
955 = getAparameter<String>(dest_pset,
"output", empty_String);
956 if ( filename_default == empty_String ) {
958 if (filename_default == empty_String) {
964 = getAparameter<String>(dest_pset,
"filename", filename_default);
965 if (explicit_filename != empty_String) filename = explicit_filename;
967 = getAparameter<String>(dest_pset,
"extension", empty_String);
968 if (explicit_extension != empty_String) {
969 if (explicit_extension[0] ==
'.') {
970 filename += explicit_extension;
972 filename = filename +
"." + explicit_extension;
979 std::string actual_filename =
filename;
980 if ( (filename !=
"cout") && (filename !=
"cerr") ) {
982 if ( filename.find(
'.') == npos ) {
983 actual_filename +=
".log";
992 <<
"Duplicate name for a MessageLogger Destination: "
994 <<
"\n" <<
"Only the first configuration instructions are used";
998 <<
"Duplicate name for a MessageLogger Destination: "
1000 <<
"\n" <<
"Only original configuration instructions are used";
1009 if( actual_filename ==
"cout" ) {
1013 else if( actual_filename ==
"cerr" ) {
1019 boost::shared_ptr<std::ofstream> os_sp(
new std::ofstream(actual_filename.c_str()));
1022 stream_ps[actual_filename] = os_sp.get();
1043 = getAparameter<vString>(*
job_pset_p,
"statistics", empty_vString);
1045 bool no_statistics_configured = statistics.empty();
1047 if ( no_statistics_configured ) {
1053 = getAparameter<vString>(*
job_pset_p,
"destinations", empty_vString);
1054 if (destinations.empty()) {
1056 no_statistics_configured = statistics.empty();
1061 for( vString::const_iterator it = statistics.begin()
1062 ; it != statistics.end()
1067 String psetname = statname;
1070 PSet stat_pset = getAparameter<PSet>(*
job_pset_p, psetname, empty_PSet);
1072 = getAparameter<bool>(stat_pset,
"placeholder",
false);
1073 if (is_placeholder)
continue;
1077 = getAparameter<String>(stat_pset,
"output", empty_String);
1078 if ( filename == empty_String ) {
1080 if (filename == empty_String) {
1081 filename = statname;
1090 = getAparameter<String>(stat_pset,
"filename",
filename);
1091 if (explicit_filename != empty_String) filename = explicit_filename;
1092 String explicit_extension
1093 = getAparameter<String>(stat_pset,
"extension", empty_String);
1094 if (explicit_extension != empty_String) {
1095 if (explicit_extension[0] ==
'.') {
1096 filename += explicit_extension;
1098 filename = filename +
"." + explicit_extension;
1105 std::string actual_filename =
filename;
1106 if ( (filename !=
"cout") && (filename !=
"cerr") ) {
1108 if ( filename.find(
'.') == npos ) {
1109 actual_filename +=
".log";
1119 <<
"Duplicate name for a MessageLogger Statistics Destination: "
1124 <<
"Duplicate name for a MessageLogger Statistics Destination: "
1126 <<
"\n" <<
"Only original configuration instructions are used";
1137 bool statistics_destination_is_real = !no_statistics_configured;
1140 if ( actual_filename ==
"cout" ) {
1142 }
else if ( actual_filename ==
"cerr" ) {
1145 boost::shared_ptr<std::ofstream> os_sp(
new std::ofstream(actual_filename.c_str()));
1151 statistics_destination_is_real =
true;
1155 if (statistics_destination_is_real) {
1160 bool reset = getAparameter<bool>(stat_pset,
"reset",
false);
1185 for( std::vector<NamedDestination*>::const_iterator it =
extern_dests.begin()
1203 std::vector<std::string> & cats)
1207 while ( i != npos ) {
1209 cats.push_back (s.substr(i,j-i));
1211 while ( (i != npos) && (s[
i] ==
'|') ) ++
i;
1232 sm[
"NoStatisticsDestinationsConfigured"] = 0.0;
virtual char const * what() const
const ELcontextSupplier & getContextSupplier() const
static unsigned char messageLoggerScribeIsRunning
virtual void runCommand(MessageLoggerQ::OpCode opcode, void *operand)
virtual ELdestControl & setLimit(const ELstring &s, int n)
MessageLoggerScribe(boost::shared_ptr< ThreadQueue > queue)
— If queue is NULL, this sets singleThread true
void log(ErrorObj *errorobj_p)
void configure_default_fwkJobReport(ELdestControl &dest_ctrl)
void setContext(const std::string &c)
virtual ELdestControl & setThreshold(const ELseverityLevel &sv)
static MessageDrop * instance()
virtual ELdestControl & setTimespan(const ELstring &s, int n)
void configure_errorlog()
void configure_statistics()
std::vector< boost::shared_ptr< std::ofstream > > file_ps
ELslProxy< ELhighestSeverityGen > const ELhighestSeverity
static const unsigned char MLSCRIBE_RUNNING_INDICATOR
boost::shared_ptr< edm::Exception > Pointer_to_new_exception_on_heap
std::vector< String > ordinary_destination_filenames
static bool debugAlwaysSuppressed
void configure_fwkJobReports()
virtual int setLineLength(int len)
void configure_ordinary_destinations()
const ELextendedID & xid() const
edm::Place_for_passing_exception_ptr epp
ELslProxy< ELzeroSeverityGen > const ELzeroSeverity
std::vector< bool > statisticsResets
boost::shared_ptr< Pointer_to_new_exception_on_heap > Place_for_passing_exception_ptr
std::vector< NamedDestination * > extern_dests
void configure_dest(ELdestControl &dest_ctrl, String const &filename)
virtual void suppressTime()
static void noteGroupedCategory(std::string const &cat)
void parseCategories(std::string const &s, std::vector< std::string > &cats)
virtual void noTerminationSummary()
boost::shared_ptr< ThreadQueue > m_queue
virtual ~MessageLoggerScribe()
static ErrorLog * static_errorlog_p
std::string jobReportOption
static bool warningAlwaysSuppressed
virtual void setID(const ELstring &ID)
std::vector< ELdestControl > statisticsDestControls
bool search_all(ForwardSequence const &s, Datum const &d)
static edm::JobMode mode(std::string const &jm)
void setContextSupplier(const ELcontextSupplier &supplier)
boost::shared_ptr< PSet > job_pset_p
virtual ELdestControl & setInterval(const ELstring &s, int interval)
void triggerStatisticsSummaries()
Func copy_all(ForwardSequence &s, Func f)
wrappers for copy
void triggerFJRmessageSummary(std::map< std::string, double > &sm)
static const std::string category("Muon|RecoMuon|L3MuonCandidateProducerFromMuons")
ELadministrator * admin_p
std::map< String, std::ostream * > stream_ps
void configure_external_dests()
bool clean_slate_configuration
ELdestControl attach(const ELdestination &sink)
static bool infoAlwaysSuppressed
void reset(double vett[256])
std::vector< String > vString
T get(const Candidate &c)
value_ptr< MessageLoggerDefaults > messageLoggerDefaults