220 , clean_slate_configuration(
true )
222 , singleThread (queue.
get() == 0)
250 m_queue->consume(opcode, operand);
268 assert( operand == 0 );
283 <<
" cms::Exceptions, text = \n"
288 cerr <<
"MessageLogger will no longer be processing "
289 <<
"messages due to errors (entering purge mode).\n";
295 std::cerr <<
"MessageLoggerScribe caught an unknown exception and "
296 <<
"will no longer be processing "
297 <<
"messages. (entering purge mode)\n";
305 job_pset_p.reset(static_cast<ParameterSet *>(operand));
311 job_pset_p.reset(static_cast<ParameterSet *>(h_p->
p));
312 boost::mutex::scoped_lock sl(h_p->
m);
323 (*ep) <<
"\n and another exception: \n" << e.
what();
338 extern_dests.push_back( static_cast<NamedDestination *>(operand) );
343 std::cerr <<
"MessageLoggerScribe caught a cms::Exception "
344 <<
"during extern dest configuration:\n"
346 <<
"This is a serious problem, and the extern dest "
347 <<
"will not be produced.\n"
348 <<
"However, the rest of the logger continues to run.\n";
352 std::cerr <<
"MessageLoggerScribe caught unkonwn exception type\n"
353 <<
"during extern dest configuration. "
354 <<
"This is a serious problem, and the extern dest "
355 <<
"will not be produced.\n"
356 <<
"The rest of the logger will attempt to continue to run.\n";
361 assert( operand == 0 );
367 std::cerr <<
"MessageLoggerScribe caught exception "
368 <<
"during summarize:\n"
373 std::cerr <<
"MessageLoggerScribe caught unkonwn exception type "
374 <<
"during summarize. (Ignored)\n";
392 assert( operand == 0 );
400 job_pset_p.reset(static_cast<ParameterSet *>(h_p->
p));
401 boost::mutex::scoped_lock sl(h_p->
m);
415 std::map<std::string, double> * smp =
416 static_cast<std::map<std::string, double> *
>(operand);
422 boost::mutex::scoped_lock sl(h_p->
m);
423 std::map<std::string, double> * smp =
424 static_cast<std::map<std::string, double> *
>(h_p->
p);
438 for (
unsigned int icat = 0; icat < categories.size(); ++icat) {
439 errorobj_p->
setID(categories[icat]);
452 String preconfiguration_message
453 = getAparameter<String>
454 (*
job_pset_p,
"generate_preconfiguration_message", empty_String);
455 if (preconfiguration_message != empty_String) {
461 LogError (
"preconfiguration") << preconfiguration_message;
465 m_queue->consume(opcode, operand);
475 <<
"The message logger has been configured multiple times";
493 static const int NO_VALUE_SET = -45654;
499 const std::string COMMON_DEFAULT_THRESHOLD =
"INFO";
500 const int COMMON_DEFAULT_LIMIT = NO_VALUE_SET;
501 const int COMMON_DEFAULT_INTERVAL = NO_VALUE_SET;
502 const int COMMON_DEFAULT_TIMESPAN = NO_VALUE_SET;
504 char const* severity_array[] = {
"WARNING",
"INFO",
"ERROR",
"DEBUG"};
505 vString const severities(severity_array+0, severity_array+4);
509 = getAparameter<vString>(*
job_pset_p,
"categories", empty_vString);
515 = getAparameter<vString>(*
job_pset_p,
"messageIDs", empty_vString);
518 copy_all( messageIDs, std::back_inserter(categories) );
526 copy_all( hardcats, std::back_inserter(categories) );
531 = getAparameter<String>(*
job_pset_p,
"threshold", empty_String);
537 = getAparameter<PSet>(*
job_pset_p,
"default", empty_PSet);
539 = getAparameter<int>(default_pset,
"limit", COMMON_DEFAULT_LIMIT);
541 = getAparameter<int>(default_pset,
"reportEvery", COMMON_DEFAULT_INTERVAL);
544 = getAparameter<int>(default_pset,
"timespan", COMMON_DEFAULT_TIMESPAN);
547 String default_pset_threshold
548 = getAparameter<String>(default_pset,
"threshold", default_threshold);
556 = getAparameter<bool>(dest_pset,
"placeholder",
false);
557 if (is_placeholder)
return;
560 PSet dest_default_pset
561 = getAparameter<PSet>(dest_pset,
"default", empty_PSet);
562 int dest_default_limit
563 = getAparameter<int>(dest_default_pset,
"limit", default_limit);
564 int dest_default_interval
565 = getAparameter<int>(dest_default_pset,
"reportEvery", default_interval);
567 int dest_default_timespan
568 = getAparameter<int>(dest_default_pset,
"timespan", default_timespan);
570 if ( dest_default_limit != NO_VALUE_SET ) {
571 if ( dest_default_limit < 0 ) dest_default_limit = 2000000000;
572 dest_ctrl.
setLimit(
"*", dest_default_limit );
574 if ( dest_default_interval != NO_VALUE_SET ) {
575 dest_ctrl.
setInterval(
"*", dest_default_interval );
577 if ( dest_default_timespan != NO_VALUE_SET ) {
578 if ( dest_default_timespan < 0 ) dest_default_timespan = 2000000000;
579 dest_ctrl.
setTimespan(
"*", dest_default_timespan );
584 = getAparameter<String>(dest_pset,
"threshold", default_threshold);
585 if (dest_threshold == empty_String) {
586 dest_threshold = default_threshold;
588 if (dest_threshold == empty_String) {
589 dest_threshold = default_pset_threshold;
591 if (dest_threshold == empty_String) {
594 if (dest_threshold == empty_String) dest_threshold = COMMON_DEFAULT_THRESHOLD;
606 for( vString::const_iterator id_it = categories.begin()
607 ; id_it != categories.end()
612 PSet default_category_pset
613 = getAparameter<PSet>(default_pset, msgID, empty_PSet);
615 = getAparameter<PSet>(dest_pset, msgID, default_category_pset);
617 int category_default_limit
618 = getAparameter<int>(default_category_pset,
"limit", NO_VALUE_SET);
620 = getAparameter<int>(category_pset,
"limit", category_default_limit);
621 if (limit == NO_VALUE_SET) limit = dest_default_limit;
623 int category_default_interval
624 = getAparameter<int>(default_category_pset,
"reportEvery", NO_VALUE_SET);
626 = getAparameter<int>(category_pset,
"reportEvery",category_default_interval);
627 if (interval == NO_VALUE_SET) interval = dest_default_interval;
629 int category_default_timespan
630 = getAparameter<int>(default_category_pset,
"timespan", NO_VALUE_SET);
632 = getAparameter<int>(category_pset,
"timespan", category_default_timespan);
633 if (timespan == NO_VALUE_SET) timespan = dest_default_timespan;
637 if ( limit == NO_VALUE_SET ) {
640 if ( interval == NO_VALUE_SET ) {
643 if ( timespan == NO_VALUE_SET ) {
647 if( limit != NO_VALUE_SET ) {
648 if ( limit < 0 ) limit = 2000000000;
651 if( interval != NO_VALUE_SET ) {
654 if( timespan != NO_VALUE_SET ) {
655 if ( timespan < 0 ) timespan = 2000000000;
662 for( vString::const_iterator sev_it = severities.begin()
663 ; sev_it != severities.end()
669 PSet default_sev_pset
670 = getAparameter<PSet>(default_pset, sevID, empty_PSet);
672 = getAparameter<PSet>(dest_pset, sevID, default_sev_pset);
674 int limit = getAparameter<int>(sev_pset,
"limit", NO_VALUE_SET);
675 if ( limit == NO_VALUE_SET ) {
678 if( limit != NO_VALUE_SET ) {
679 if (limit < 0) limit = 2000000000;
680 dest_ctrl.
setLimit(severity, limit );
682 int interval = getAparameter<int>(sev_pset,
"reportEvery", NO_VALUE_SET);
683 if ( interval == NO_VALUE_SET ) {
686 if( interval != NO_VALUE_SET ) dest_ctrl.
setInterval(severity, interval);
688 int timespan = getAparameter<int>(sev_pset,
"timespan", NO_VALUE_SET);
689 if ( timespan == NO_VALUE_SET ) {
692 if( timespan != NO_VALUE_SET ) {
693 if (timespan < 0) timespan = 2000000000;
699 bool noLineBreaks_default
700 = getAparameter<bool> (default_pset,
"noLineBreaks",
false);
703 = getAparameter<bool> (dest_pset,
"noLineBreaks", noLineBreaks_default);
710 = getAparameter<int> (default_pset,
"lineLength", lenDef);
712 int lineLen = getAparameter<int> (dest_pset,
"lineLength", lineLen_default);
713 if (lineLen != lenDef) {
719 bool suppressTime_default
720 = getAparameter<bool> (default_pset,
"noTimeStamps",
false);
722 = getAparameter<bool> (dest_pset,
"noTimeStamps", suppressTime_default);
743 = getAparameter<vString>(*
job_pset_p,
"destinations", empty_vString);
747 if (destinations.empty()) {
752 if( ! destinations.empty() )
756 for( vString::const_iterator it = destinations.begin()
757 ; it != destinations.end()
765 PSet dest_pset = getAparameter<PSet>(*
job_pset_p, psetname, empty_PSet);
767 = getAparameter<bool>(dest_pset,
"placeholder",
false);
768 if (is_placeholder)
continue;
783 = getAparameter<String>(dest_pset,
"output", empty_String);
784 if ( filename_default == empty_String ) {
786 if (filename_default == empty_String) {
792 = getAparameter<String>(dest_pset,
"filename", filename_default);
793 if (explicit_filename != empty_String) filename = explicit_filename;
795 = getAparameter<String>(dest_pset,
"extension", empty_String);
796 if (explicit_extension != empty_String) {
797 if (explicit_extension[0] ==
'.') {
798 filename += explicit_extension;
800 filename = filename +
"." + explicit_extension;
808 if ( (filename !=
"cout") && (filename !=
"cerr") ) {
810 if ( filename.find(
'.') == npos ) {
811 actual_filename +=
".log";
820 <<
"Duplicate name for a MessageLogger Destination: "
822 <<
"\n" <<
"Only the first configuration instructions are used";
826 <<
"Duplicate name for a MessageLogger Destination: "
828 <<
"\n" <<
"Only original configuration instructions are used";
837 if( actual_filename ==
"cout" ) {
841 else if( actual_filename ==
"cerr" ) {
847 boost::shared_ptr<std::ofstream> os_sp(
new std::ofstream(actual_filename.c_str()));
850 stream_ps[actual_filename] = os_sp.get();
870 = getAparameter<vString>(*
job_pset_p,
"statistics", empty_vString);
872 bool no_statistics_configured = statistics.empty();
874 if ( no_statistics_configured ) {
880 = getAparameter<vString>(*
job_pset_p,
"destinations", empty_vString);
881 if (destinations.empty()) {
883 no_statistics_configured = statistics.empty();
888 for( vString::const_iterator it = statistics.begin()
889 ; it != statistics.end()
894 String psetname = statname;
897 PSet stat_pset = getAparameter<PSet>(*
job_pset_p, psetname, empty_PSet);
899 = getAparameter<bool>(stat_pset,
"placeholder",
false);
900 if (is_placeholder)
continue;
904 = getAparameter<String>(stat_pset,
"output", empty_String);
905 if ( filename == empty_String ) {
907 if (filename == empty_String) {
917 = getAparameter<String>(stat_pset,
"filename",
filename);
918 if (explicit_filename != empty_String) filename = explicit_filename;
920 = getAparameter<String>(stat_pset,
"extension", empty_String);
921 if (explicit_extension != empty_String) {
922 if (explicit_extension[0] ==
'.') {
923 filename += explicit_extension;
925 filename = filename +
"." + explicit_extension;
933 if ( (filename !=
"cout") && (filename !=
"cerr") ) {
935 if ( filename.find(
'.') == npos ) {
936 actual_filename +=
".log";
946 <<
"Duplicate name for a MessageLogger Statistics Destination: "
951 <<
"Duplicate name for a MessageLogger Statistics Destination: "
953 <<
"\n" <<
"Only original configuration instructions are used";
964 bool statistics_destination_is_real = !no_statistics_configured;
967 if ( actual_filename ==
"cout" ) {
969 }
else if ( actual_filename ==
"cerr" ) {
972 boost::shared_ptr<std::ofstream> os_sp(
new std::ofstream(actual_filename.c_str()));
978 statistics_destination_is_real =
true;
982 if (statistics_destination_is_real) {
987 bool reset = getAparameter<bool>(stat_pset,
"reset",
false);
1012 for( std::vector<NamedDestination*>::const_iterator it =
extern_dests.begin()
1030 std::vector<std::string> & cats)
1034 while ( i != npos ) {
1036 cats.push_back (s.substr(i,j-i));
1038 while ( (i != npos) && (s[
i] ==
'|') ) ++
i;
1059 sm[
"NoStatisticsDestinationsConfigured"] = 0.0;
virtual char const * what() const
static unsigned char messageLoggerScribeIsRunning
virtual void runCommand(MessageLoggerQ::OpCode opcode, void *operand)
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)
ELdestControl & setThreshold(const ELseverityLevel &sv)
static MessageDrop * instance()
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
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)
static void noteGroupedCategory(std::string const &cat)
void parseCategories(std::string const &s, std::vector< std::string > &cats)
void noTerminationSummary()
boost::shared_ptr< ThreadQueue > m_queue
virtual ~MessageLoggerScribe()
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)
boost::shared_ptr< PSet > job_pset_p
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)
std::map< String, std::ostream * > stream_ps
void configure_external_dests()
volatile std::atomic< bool > shutdown_flag false
bool clean_slate_configuration
static bool infoAlwaysSuppressed
void reset(double vett[256])
boost::shared_ptr< ELadministrator > admin_p
std::vector< String > vString
T get(const Candidate &c)
value_ptr< MessageLoggerDefaults > messageLoggerDefaults