218 , clean_slate_configuration(
true )
220 , singleThread (queue.
get() == 0)
247 m_queue->consume(opcode, operand);
265 assert( operand == 0 );
280 <<
" cms::Exceptions, text = \n" 285 cerr <<
"MessageLogger will no longer be processing " 286 <<
"messages due to errors (entering purge mode).\n";
292 std::cerr <<
"MessageLoggerScribe caught an unknown exception and " 293 <<
"will no longer be processing " 294 <<
"messages. (entering purge mode)\n";
309 std::lock_guard<std::mutex> sl(h_p->
m);
317 *epp = std::make_shared<edm::Exception>(
e);
320 (*ep) <<
"\n and another exception: \n" << e.
what();
334 assert( operand == 0 );
340 std::cerr <<
"MessageLoggerScribe caught exception " 341 <<
"during summarize:\n" 346 std::cerr <<
"MessageLoggerScribe caught unkonwn exception type " 347 <<
"during summarize. (Ignored)\n";
365 assert( operand == 0 );
374 std::lock_guard<std::mutex> sl(h_p->
m);
388 std::map<std::string, double> * smp =
389 static_cast<std::map<std::string, double> *
>(operand);
395 std::lock_guard<std::mutex> sl(h_p->
m);
396 std::map<std::string, double> * smp =
397 static_cast<std::map<std::string, double> *
>(h_p->
p);
411 for (
unsigned int icat = 0; icat < categories.size(); ++icat) {
412 errorobj_p->
setID(categories[icat]);
425 String preconfiguration_message
426 = getAparameter<String>
427 (*
job_pset_p,
"generate_preconfiguration_message", empty_String);
428 if (preconfiguration_message != empty_String) {
434 LogError (
"preconfiguration") << preconfiguration_message;
438 m_queue->consume(opcode, operand);
448 <<
"The message logger has been configured multiple times";
463 static const int NO_VALUE_SET = -45654;
469 const std::string COMMON_DEFAULT_THRESHOLD =
"INFO";
470 const int COMMON_DEFAULT_LIMIT = NO_VALUE_SET;
471 const int COMMON_DEFAULT_INTERVAL = NO_VALUE_SET;
472 const int COMMON_DEFAULT_TIMESPAN = NO_VALUE_SET;
474 char const* severity_array[] = {
"WARNING",
"INFO",
"ERROR",
"DEBUG"};
475 vString const severities(severity_array+0, severity_array+4);
479 = getAparameter<vString>(*
job_pset_p,
"categories", empty_vString);
485 = getAparameter<vString>(*
job_pset_p,
"messageIDs", empty_vString);
488 copy_all( messageIDs, std::back_inserter(categories) );
496 copy_all( hardcats, std::back_inserter(categories) );
501 = getAparameter<String>(*
job_pset_p,
"threshold", empty_String);
507 = getAparameter<PSet>(*
job_pset_p,
"default", empty_PSet);
509 = getAparameter<int>(default_pset,
"limit", COMMON_DEFAULT_LIMIT);
511 = getAparameter<int>(default_pset,
"reportEvery", COMMON_DEFAULT_INTERVAL);
514 = getAparameter<int>(default_pset,
"timespan", COMMON_DEFAULT_TIMESPAN);
517 String default_pset_threshold
518 = getAparameter<String>(default_pset,
"threshold", default_threshold);
526 = getAparameter<bool>(dest_pset,
"placeholder",
false);
527 if (is_placeholder)
return;
530 PSet dest_default_pset
531 = getAparameter<PSet>(dest_pset,
"default", empty_PSet);
532 int dest_default_limit
533 = getAparameter<int>(dest_default_pset,
"limit", default_limit);
534 int dest_default_interval
535 = getAparameter<int>(dest_default_pset,
"reportEvery", default_interval);
537 int dest_default_timespan
538 = getAparameter<int>(dest_default_pset,
"timespan", default_timespan);
540 if ( dest_default_limit != NO_VALUE_SET ) {
541 if ( dest_default_limit < 0 ) dest_default_limit = 2000000000;
542 dest_ctrl->setLimit(
"*", dest_default_limit );
544 if ( dest_default_interval != NO_VALUE_SET ) {
545 dest_ctrl->setInterval(
"*", dest_default_interval );
547 if ( dest_default_timespan != NO_VALUE_SET ) {
548 if ( dest_default_timespan < 0 ) dest_default_timespan = 2000000000;
549 dest_ctrl->setTimespan(
"*", dest_default_timespan );
554 = getAparameter<String>(dest_pset,
"threshold", default_threshold);
555 if (dest_threshold == empty_String) {
556 dest_threshold = default_threshold;
558 if (dest_threshold == empty_String) {
559 dest_threshold = default_pset_threshold;
561 if (dest_threshold == empty_String) {
564 if (dest_threshold == empty_String) dest_threshold = COMMON_DEFAULT_THRESHOLD;
566 dest_ctrl->setThreshold(threshold_sev);
576 for( vString::const_iterator id_it = categories.begin()
577 ; id_it != categories.end()
582 PSet default_category_pset
583 = getAparameter<PSet>(default_pset, msgID, empty_PSet);
585 = getAparameter<PSet>(dest_pset, msgID, default_category_pset);
587 int category_default_limit
588 = getAparameter<int>(default_category_pset,
"limit", NO_VALUE_SET);
590 = getAparameter<int>(category_pset,
"limit", category_default_limit);
591 if (limit == NO_VALUE_SET) limit = dest_default_limit;
593 int category_default_interval
594 = getAparameter<int>(default_category_pset,
"reportEvery", NO_VALUE_SET);
596 = getAparameter<int>(category_pset,
"reportEvery",category_default_interval);
597 if (interval == NO_VALUE_SET) interval = dest_default_interval;
599 int category_default_timespan
600 = getAparameter<int>(default_category_pset,
"timespan", NO_VALUE_SET);
602 = getAparameter<int>(category_pset,
"timespan", category_default_timespan);
603 if (timespan == NO_VALUE_SET) timespan = dest_default_timespan;
607 if ( limit == NO_VALUE_SET ) {
610 if ( interval == NO_VALUE_SET ) {
613 if ( timespan == NO_VALUE_SET ) {
617 if( limit != NO_VALUE_SET ) {
618 if ( limit < 0 ) limit = 2000000000;
619 dest_ctrl->setLimit(msgID, limit);
621 if( interval != NO_VALUE_SET ) {
622 dest_ctrl->setInterval(msgID, interval);
624 if( timespan != NO_VALUE_SET ) {
625 if ( timespan < 0 ) timespan = 2000000000;
626 dest_ctrl->setTimespan(msgID, timespan);
632 for( vString::const_iterator sev_it = severities.begin()
633 ; sev_it != severities.end()
639 PSet default_sev_pset
640 = getAparameter<PSet>(default_pset, sevID, empty_PSet);
642 = getAparameter<PSet>(dest_pset, sevID, default_sev_pset);
644 int limit = getAparameter<int>(sev_pset,
"limit", NO_VALUE_SET);
645 if ( limit == NO_VALUE_SET ) {
648 if( limit != NO_VALUE_SET ) {
649 if (limit < 0) limit = 2000000000;
650 dest_ctrl->setLimit(severity, limit );
652 int interval = getAparameter<int>(sev_pset,
"reportEvery", NO_VALUE_SET);
653 if ( interval == NO_VALUE_SET ) {
656 if( interval != NO_VALUE_SET ) dest_ctrl->setInterval(severity, interval);
658 int timespan = getAparameter<int>(sev_pset,
"timespan", NO_VALUE_SET);
659 if ( timespan == NO_VALUE_SET ) {
662 if( timespan != NO_VALUE_SET ) {
663 if (timespan < 0) timespan = 2000000000;
664 dest_ctrl->setTimespan(severity, timespan );
669 bool noLineBreaks_default
670 = getAparameter<bool> (default_pset,
"noLineBreaks",
false);
673 = getAparameter<bool> (dest_pset,
"noLineBreaks", noLineBreaks_default);
675 dest_ctrl->setLineLength(32000);
680 = getAparameter<int> (default_pset,
"lineLength", lenDef);
682 int lineLen = getAparameter<int> (dest_pset,
"lineLength", lineLen_default);
683 if (lineLen != lenDef) {
684 dest_ctrl->setLineLength(lineLen);
689 bool suppressTime_default
690 = getAparameter<bool> (default_pset,
"noTimeStamps",
false);
692 = getAparameter<bool> (dest_pset,
"noTimeStamps", suppressTime_default);
694 dest_ctrl->suppressTime();
713 = getAparameter<vString>(*
job_pset_p,
"destinations", empty_vString);
717 if (destinations.empty()) {
722 if( ! destinations.empty() )
726 for( vString::const_iterator it = destinations.begin()
727 ; it != destinations.end()
735 PSet dest_pset = getAparameter<PSet>(*
job_pset_p, psetname, empty_PSet);
737 = getAparameter<bool>(dest_pset,
"placeholder",
false);
738 if (is_placeholder)
continue;
753 = getAparameter<String>(dest_pset,
"output", empty_String);
754 if ( filename_default == empty_String ) {
756 if (filename_default == empty_String) {
762 = getAparameter<String>(dest_pset,
"filename", filename_default);
763 if (explicit_filename != empty_String) filename = explicit_filename;
765 = getAparameter<String>(dest_pset,
"extension", empty_String);
766 if (explicit_extension != empty_String) {
767 if (explicit_extension[0] ==
'.') {
768 filename += explicit_extension;
770 filename = filename +
"." + explicit_extension;
778 if ( (filename !=
"cout") && (filename !=
"cerr") ) {
780 if ( filename.find(
'.') == npos ) {
781 actual_filename +=
".log";
790 <<
"Duplicate name for a MessageLogger Destination: " 792 <<
"\n" <<
"Only the first configuration instructions are used";
796 <<
"Duplicate name for a MessageLogger Destination: " 798 <<
"\n" <<
"Only original configuration instructions are used";
806 std::shared_ptr<ELdestination> dest_ctrl;
807 if( actual_filename ==
"cout" ) {
808 dest_ctrl = std::make_shared<ELoutput>(
std::cout);
812 else if( actual_filename ==
"cerr" ) {
818 auto os_sp = std::make_shared<std::ofstream>(actual_filename.c_str());
820 dest_ctrl = std::make_shared<ELoutput>(*os_sp);
822 stream_ps[actual_filename] = os_sp.get();
842 = getAparameter<vString>(*
job_pset_p,
"statistics", empty_vString);
844 bool no_statistics_configured = statistics.empty();
846 if ( no_statistics_configured ) {
852 = getAparameter<vString>(*
job_pset_p,
"destinations", empty_vString);
853 if (destinations.empty()) {
855 no_statistics_configured = statistics.empty();
860 for( vString::const_iterator it = statistics.begin()
861 ; it != statistics.end()
866 String psetname = statname;
869 PSet stat_pset = getAparameter<PSet>(*
job_pset_p, psetname, empty_PSet);
871 = getAparameter<bool>(stat_pset,
"placeholder",
false);
872 if (is_placeholder)
continue;
876 = getAparameter<String>(stat_pset,
"output", empty_String);
877 if ( filename == empty_String ) {
879 if (filename == empty_String) {
889 = getAparameter<String>(stat_pset,
"filename",
filename);
890 if (explicit_filename != empty_String) filename = explicit_filename;
892 = getAparameter<String>(stat_pset,
"extension", empty_String);
893 if (explicit_extension != empty_String) {
894 if (explicit_extension[0] ==
'.') {
895 filename += explicit_extension;
897 filename = filename +
"." + explicit_extension;
905 if ( (filename !=
"cout") && (filename !=
"cerr") ) {
907 if ( filename.find(
'.') == npos ) {
908 actual_filename +=
".log";
918 <<
"Duplicate name for a MessageLogger Statistics Destination: " 923 <<
"Duplicate name for a MessageLogger Statistics Destination: " 925 <<
"\n" <<
"Only original configuration instructions are used";
936 bool statistics_destination_is_real = !no_statistics_configured;
939 if ( actual_filename ==
"cout" ) {
941 }
else if ( actual_filename ==
"cerr" ) {
944 auto os_sp = std::make_shared<std::ofstream>(actual_filename.c_str());
950 statistics_destination_is_real =
true;
954 if (statistics_destination_is_real) {
956 auto stat = std::make_shared<ELstatistics>(*os_p);
959 bool reset = getAparameter<bool>(stat_pset,
"reset",
false);
967 stat->noTerminationSummary();
976 std::vector<std::string> & cats)
980 while ( i != npos ) {
982 cats.push_back (s.substr(i,j-i));
984 while ( (i != npos) && (s[
i] ==
'|') ) ++
i;
1005 sm[
"NoStatisticsDestinationsConfigured"] = 0.0;
static unsigned char messageLoggerScribeIsRunning
std::map< String, edm::propagate_const< std::ostream * > > stream_ps
virtual void runCommand(MessageLoggerQ::OpCode opcode, void *operand)
void log(ErrorObj *errorobj_p)
static MessageDrop * instance()
char const * what() const override
void configure_errorlog()
void configure_statistics()
ELslProxy< ELhighestSeverityGen > const ELhighestSeverity
static const unsigned char MLSCRIBE_RUNNING_INDICATOR
std::vector< String > ordinary_destination_filenames
static bool debugAlwaysSuppressed
edm::propagate_const< std::shared_ptr< ELadministrator > > admin_p
void configure_ordinary_destinations()
const ELextendedID & xid() const
edm::Place_for_passing_exception_ptr epp
ELslProxy< ELzeroSeverityGen > const ELzeroSeverity
void configure_dest(std::shared_ptr< ELdestination > dest_ctrl, String const &filename)
std::vector< bool > statisticsResets
std::vector< std::shared_ptr< ELstatistics > > statisticsDestControls
std::vector< edm::propagate_const< std::shared_ptr< std::ofstream > > > file_ps
std::shared_ptr< ELdestination > early_dest
static void noteGroupedCategory(std::string const &cat)
void parseCategories(std::string const &s, std::vector< std::string > &cats)
virtual ~MessageLoggerScribe()
static bool warningAlwaysSuppressed
edm::propagate_const< std::shared_ptr< PSet > > job_pset_p
virtual void setID(const ELstring &ID)
std::condition_variable c
bool search_all(ForwardSequence const &s, Datum const &d)
static edm::JobMode mode(std::string const &jm)
void triggerStatisticsSummaries()
MessageLoggerScribe(std::shared_ptr< ThreadQueue > queue)
— If queue is NULL, this sets singleThread true
Func copy_all(ForwardSequence &s, Func f)
wrappers for copy
void triggerFJRmessageSummary(std::map< std::string, double > &sm)
edm::propagate_const< std::shared_ptr< ThreadQueue > > m_queue
bool clean_slate_configuration
static bool infoAlwaysSuppressed
void reset(double vett[256])
std::vector< String > vString
T get(const Candidate &c)
std::shared_ptr< Pointer_to_new_exception_on_heap > Place_for_passing_exception_ptr
value_ptr< MessageLoggerDefaults > messageLoggerDefaults
std::shared_ptr< edm::Exception > Pointer_to_new_exception_on_heap