217 clean_slate_configuration(
true),
242 m_queue->consume(opcode, operand);
258 assert(operand ==
nullptr);
270 std::cerr <<
"MessageLoggerScribe caught " <<
count <<
" cms::Exceptions, text = \n" << e.
what() <<
"\n";
273 cerr <<
"MessageLogger will no longer be processing " 274 <<
"messages due to errors (entering purge mode).\n";
278 std::cerr <<
"MessageLoggerScribe caught an unknown exception and " 279 <<
"will no longer be processing " 280 <<
"messages. (entering purge mode)\n";
289 std::shared_ptr<PSet>(
static_cast<PSet*
>(operand));
295 std::shared_ptr<PSet>(
static_cast<PSet*
>(h_p->
p));
296 std::lock_guard<std::mutex> sl(h_p->
m);
302 *epp = std::make_shared<edm::Exception>(
e);
305 (*ep) <<
"\n and another exception: \n" << e.
what();
319 assert(operand ==
nullptr);
323 std::cerr <<
"MessageLoggerScribe caught exception " 324 <<
"during summarize:\n" 327 std::cerr <<
"MessageLoggerScribe caught unkonwn exception type " 328 <<
"during summarize. (Ignored)\n";
344 assert(operand ==
nullptr);
353 std::lock_guard<std::mutex> sl(h_p->
m);
366 std::map<std::string, double>* smp =
static_cast<std::map<std::string, double>*
>(operand);
371 std::lock_guard<std::mutex> sl(h_p->
m);
372 std::map<std::string, double>* smp =
static_cast<std::map<std::string, double>*
>(h_p->
p);
386 for (
unsigned int icat = 0; icat < categories.size(); ++icat) {
387 errorobj_p->
setID(categories[icat]);
398 String preconfiguration_message =
399 getAparameter<String>(*
job_pset_p,
"generate_preconfiguration_message", empty_String);
400 if (preconfiguration_message != empty_String) {
406 LogError(
"preconfiguration") << preconfiguration_message;
410 m_queue->consume(opcode, operand);
419 LogWarning(
"multiLogConfig") <<
"The message logger has been configured multiple times";
427 static const int NO_VALUE_SET = -45654;
433 const std::string COMMON_DEFAULT_THRESHOLD =
"INFO";
434 const int COMMON_DEFAULT_LIMIT = NO_VALUE_SET;
435 const int COMMON_DEFAULT_INTERVAL = NO_VALUE_SET;
436 const int COMMON_DEFAULT_TIMESPAN = NO_VALUE_SET;
438 char const* severity_array[] = {
"WARNING",
"INFO",
"ERROR",
"DEBUG"};
439 vString const severities(severity_array + 0, severity_array + 4);
447 vString messageIDs = getAparameter<vString>(*
job_pset_p,
"messageIDs", empty_vString);
450 copy_all(messageIDs, std::back_inserter(categories));
458 copy_all(hardcats, std::back_inserter(categories));
462 String default_threshold = getAparameter<String>(*
job_pset_p,
"threshold", empty_String);
467 PSet default_pset = getAparameter<PSet>(*
job_pset_p,
"default", empty_PSet);
468 int default_limit = getAparameter<int>(default_pset,
"limit", COMMON_DEFAULT_LIMIT);
469 int default_interval = getAparameter<int>(default_pset,
"reportEvery", COMMON_DEFAULT_INTERVAL);
471 int default_timespan = getAparameter<int>(default_pset,
"timespan", COMMON_DEFAULT_TIMESPAN);
474 String default_pset_threshold = getAparameter<String>(default_pset,
"threshold", default_threshold);
481 bool is_placeholder = getAparameter<bool>(dest_pset,
"placeholder",
false);
486 PSet dest_default_pset = getAparameter<PSet>(dest_pset,
"default", empty_PSet);
487 int dest_default_limit = getAparameter<int>(dest_default_pset,
"limit", default_limit);
488 int dest_default_interval = getAparameter<int>(dest_default_pset,
"reportEvery", default_interval);
490 int dest_default_timespan = getAparameter<int>(dest_default_pset,
"timespan", default_timespan);
492 if (dest_default_limit != NO_VALUE_SET) {
493 if (dest_default_limit < 0)
494 dest_default_limit = 2000000000;
495 dest_ctrl->setLimit(
"*", dest_default_limit);
497 if (dest_default_interval != NO_VALUE_SET) {
498 dest_ctrl->setInterval(
"*", dest_default_interval);
500 if (dest_default_timespan != NO_VALUE_SET) {
501 if (dest_default_timespan < 0)
502 dest_default_timespan = 2000000000;
503 dest_ctrl->setTimespan(
"*", dest_default_timespan);
507 String dest_threshold = getAparameter<String>(dest_pset,
"threshold", default_threshold);
508 if (dest_threshold == empty_String) {
509 dest_threshold = default_threshold;
511 if (dest_threshold == empty_String) {
512 dest_threshold = default_pset_threshold;
514 if (dest_threshold == empty_String) {
517 if (dest_threshold == empty_String)
518 dest_threshold = COMMON_DEFAULT_THRESHOLD;
520 dest_ctrl->setThreshold(threshold_sev);
533 for (vString::const_iterator id_it = categories.begin(); id_it != categories.end(); ++id_it) {
535 PSet default_category_pset = getAparameter<PSet>(default_pset, msgID, empty_PSet);
536 PSet category_pset = getAparameter<PSet>(dest_pset, msgID, default_category_pset);
538 int category_default_limit = getAparameter<int>(default_category_pset,
"limit", NO_VALUE_SET);
539 int limit = getAparameter<int>(category_pset,
"limit", category_default_limit);
540 if (limit == NO_VALUE_SET)
541 limit = dest_default_limit;
543 int category_default_interval = getAparameter<int>(default_category_pset,
"reportEvery", NO_VALUE_SET);
544 int interval = getAparameter<int>(category_pset,
"reportEvery", category_default_interval);
545 if (interval == NO_VALUE_SET)
546 interval = dest_default_interval;
548 int category_default_timespan = getAparameter<int>(default_category_pset,
"timespan", NO_VALUE_SET);
549 int timespan = getAparameter<int>(category_pset,
"timespan", category_default_timespan);
550 if (timespan == NO_VALUE_SET)
551 timespan = dest_default_timespan;
555 if (limit == NO_VALUE_SET) {
558 if (interval == NO_VALUE_SET) {
561 if (timespan == NO_VALUE_SET) {
565 if (limit != NO_VALUE_SET) {
568 dest_ctrl->setLimit(msgID, limit);
570 if (interval != NO_VALUE_SET) {
571 dest_ctrl->setInterval(msgID, interval);
573 if (timespan != NO_VALUE_SET) {
575 timespan = 2000000000;
576 dest_ctrl->setTimespan(msgID, timespan);
582 for (vString::const_iterator sev_it = severities.begin(); sev_it != severities.end(); ++sev_it) {
585 PSet default_sev_pset = getAparameter<PSet>(default_pset, sevID, empty_PSet);
586 PSet sev_pset = getAparameter<PSet>(dest_pset, sevID, default_sev_pset);
588 int limit = getAparameter<int>(sev_pset,
"limit", NO_VALUE_SET);
589 if (limit == NO_VALUE_SET) {
592 if (limit != NO_VALUE_SET) {
595 dest_ctrl->setLimit(severity, limit);
597 int interval = getAparameter<int>(sev_pset,
"reportEvery", NO_VALUE_SET);
598 if (interval == NO_VALUE_SET) {
601 if (interval != NO_VALUE_SET)
602 dest_ctrl->setInterval(severity, interval);
604 int timespan = getAparameter<int>(sev_pset,
"timespan", NO_VALUE_SET);
605 if (timespan == NO_VALUE_SET) {
608 if (timespan != NO_VALUE_SET) {
610 timespan = 2000000000;
611 dest_ctrl->setTimespan(severity, timespan);
616 bool noLineBreaks_default = getAparameter<bool>(default_pset,
"noLineBreaks",
false);
618 bool noLineBreaks = getAparameter<bool>(dest_pset,
"noLineBreaks", noLineBreaks_default);
620 dest_ctrl->setLineLength(32000);
623 int lineLen_default = getAparameter<int>(default_pset,
"lineLength", lenDef);
625 int lineLen = getAparameter<int>(dest_pset,
"lineLength", lineLen_default);
626 if (lineLen != lenDef) {
627 dest_ctrl->setLineLength(lineLen);
632 bool suppressTime_default = getAparameter<bool>(default_pset,
"noTimeStamps",
false);
633 bool suppressTime = getAparameter<bool>(dest_pset,
"noTimeStamps", suppressTime_default);
635 dest_ctrl->suppressTime();
656 if (destinations.empty()) {
661 if (!destinations.empty())
665 for (vString::const_iterator it = destinations.begin(); it != destinations.end(); ++it) {
670 PSet dest_pset = getAparameter<PSet>(*
job_pset_p, psetname, empty_PSet);
671 bool is_placeholder = getAparameter<bool>(dest_pset,
"placeholder",
false);
687 String filename_default = getAparameter<String>(dest_pset,
"output", empty_String);
688 if (filename_default == empty_String) {
690 if (filename_default == empty_String) {
695 String explicit_filename = getAparameter<String>(dest_pset,
"filename", filename_default);
696 if (explicit_filename != empty_String)
697 filename = explicit_filename;
698 String explicit_extension = getAparameter<String>(dest_pset,
"extension", empty_String);
699 if (explicit_extension != empty_String) {
700 if (explicit_extension[0] ==
'.') {
701 filename += explicit_extension;
703 filename = filename +
"." + explicit_extension;
711 if ((filename !=
"cout") && (filename !=
"cerr")) {
713 if (filename.find(
'.') == npos) {
714 actual_filename +=
".log";
723 <<
"Duplicate name for a MessageLogger Destination: " << actual_filename <<
"\n" 724 <<
"Only the first configuration instructions are used";
728 <<
"Duplicate name for a MessageLogger Destination: " << actual_filename <<
"\n" 729 <<
"Only original configuration instructions are used";
737 std::shared_ptr<ELdestination> dest_ctrl;
738 if (actual_filename ==
"cout") {
739 dest_ctrl = std::make_shared<ELoutput>(
std::cout);
742 }
else if (actual_filename ==
"cerr") {
747 auto os_sp = std::make_shared<std::ofstream>(actual_filename.c_str());
749 dest_ctrl = std::make_shared<ELoutput>(*os_sp);
751 stream_ps[actual_filename] = os_sp.get();
769 bool no_statistics_configured = statistics.empty();
771 if (no_statistics_configured) {
777 if (destinations.empty()) {
779 no_statistics_configured = statistics.empty();
784 for (vString::const_iterator it = statistics.begin(); it != statistics.end(); ++it) {
786 const String& psetname = statname;
789 PSet stat_pset = getAparameter<PSet>(*
job_pset_p, psetname, empty_PSet);
790 bool is_placeholder = getAparameter<bool>(stat_pset,
"placeholder",
false);
795 String filename = getAparameter<String>(stat_pset,
"output", empty_String);
796 if (filename == empty_String) {
798 if (filename == empty_String) {
807 String explicit_filename = getAparameter<String>(stat_pset,
"filename",
filename);
808 if (explicit_filename != empty_String)
809 filename = explicit_filename;
810 String explicit_extension = getAparameter<String>(stat_pset,
"extension", empty_String);
811 if (explicit_extension != empty_String) {
812 if (explicit_extension[0] ==
'.') {
813 filename += explicit_extension;
815 filename = filename +
"." + explicit_extension;
823 if ((filename !=
"cout") && (filename !=
"cerr")) {
825 if (filename.find(
'.') == npos) {
826 actual_filename +=
".log";
836 <<
"Duplicate name for a MessageLogger Statistics Destination: " << actual_filename <<
"\n";
839 <<
"Duplicate name for a MessageLogger Statistics Destination: " << actual_filename <<
"\n" 840 <<
"Only original configuration instructions are used";
851 bool statistics_destination_is_real = !no_statistics_configured;
854 if (actual_filename ==
"cout") {
856 }
else if (actual_filename ==
"cerr") {
859 auto os_sp = std::make_shared<std::ofstream>(actual_filename.c_str());
865 statistics_destination_is_real =
true;
869 if (statistics_destination_is_real) {
871 auto stat = std::make_shared<ELstatistics>(*os_p);
874 bool reset = getAparameter<bool>(stat_pset,
"reset",
false);
882 stat->noTerminationSummary();
894 cats.push_back(s.substr(i, j - i));
896 while ((i != npos) && (s[
i] ==
'|'))
916 sm[
"NoStatisticsDestinationsConfigured"] = 0.0;
static unsigned char messageLoggerScribeIsRunning
void log(ErrorObj *errorobj_p)
static MessageDrop * instance()
char const * what() const override
void configure_errorlog()
~MessageLoggerScribe() override
void configure_statistics()
ELslProxy< ELhighestSeverityGen > const ELhighestSeverity
static const unsigned char MLSCRIBE_RUNNING_INDICATOR
std::vector< String > ordinary_destination_filenames
static bool debugAlwaysSuppressed
void runCommand(MessageLoggerQ::OpCode opcode, void *operand) override
std::map< String, edm::propagate_const< std::ostream * > > stream_ps
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)
static bool warningAlwaysSuppressed
edm::propagate_const< std::shared_ptr< PSet > > job_pset_p
virtual void setID(const ELstring &ID)
T const & get(Event const &event, InputTag const &tag)(false)
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
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