217 clean_slate_configuration(
true),
219 singleThread(
queue.
get() == nullptr)
242 m_queue->consume(opcode, operand);
258 assert(operand ==
nullptr);
264 ErrorObj* errorobj_p = static_cast<ErrorObj*>(operand);
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";
333 std::string* jobMode_p = static_cast<std::string*>(operand);
344 assert(operand ==
nullptr);
352 job_pset_p = std::shared_ptr<PSet>(static_cast<PSet*>(h_p->
p));
353 std::lock_guard<std::mutex> sl(h_p->
m);
359 std::string* cat_p = static_cast<std::string*>(operand);
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) {
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);
412 ErrorObj* errorobj_p = static_cast<ErrorObj*>(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);
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);
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);
508 if (dest_threshold == empty_String) {
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);
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);
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) {
561 if (timespan == NO_VALUE_SET) {
565 if (
limit != NO_VALUE_SET) {
568 dest_ctrl->setLimit(msgID,
limit);
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) {
597 int interval = getAparameter<int>(sev_pset,
"reportEvery", NO_VALUE_SET);
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();
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)
698 String explicit_extension = getAparameter<String>(dest_pset,
"extension", empty_String);
699 if (explicit_extension != empty_String) {
700 if (explicit_extension[0] ==
'.') {
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) {
779 no_statistics_configured =
statistics.empty();
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);
807 String explicit_filename = getAparameter<String>(stat_pset,
"filename",
filename);
808 if (explicit_filename != empty_String)
810 String explicit_extension = getAparameter<String>(stat_pset,
"extension", empty_String);
811 if (explicit_extension != empty_String) {
812 if (explicit_extension[0] ==
'.') {
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;