CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Static Public Member Functions | Private Types | Private Member Functions | Private Attributes | Static Private Attributes
edm::service::MessageLoggerScribe Class Reference

#include <MessageLoggerScribe.h>

Inheritance diagram for edm::service::MessageLoggerScribe:
edm::service::AbstractMLscribe

Public Member Functions

 MessageLoggerScribe (boost::shared_ptr< ThreadQueue > queue)
 — If queue is NULL, this sets singleThread true More...
 
virtual void run ()
 
virtual void runCommand (MessageLoggerQ::OpCode opcode, void *operand)
 
virtual ~MessageLoggerScribe ()
 
- Public Member Functions inherited from edm::service::AbstractMLscribe
 AbstractMLscribe ()
 
virtual ~AbstractMLscribe ()
 

Static Public Member Functions

static ErrorLoggetErrorLog_ptr ()
 

Private Types

typedef ParameterSet PSet
 
typedef std::string String
 
typedef std::vector< StringvString
 

Private Member Functions

void configure_default_fwkJobReport (ELdestControl &dest_ctrl)
 
void configure_dest (ELdestControl &dest_ctrl, String const &filename)
 
void configure_errorlog ()
 
void configure_external_dests ()
 
void configure_fwkJobReports ()
 
void configure_ordinary_destinations ()
 
void configure_statistics ()
 
template<class T >
T getAparameter (PSet const &p, std::string const &id, T const &def)
 
void log (ErrorObj *errorobj_p)
 
void parseCategories (std::string const &s, std::vector< std::string > &cats)
 
void setStaticErrorLog_ptr ()
 
void triggerFJRmessageSummary (std::map< std::string, double > &sm)
 
void triggerStatisticsSummaries ()
 

Private Attributes

bool active
 
ELadministratoradmin_p
 
bool clean_slate_configuration
 
int count
 
bool done
 
ELdestControl early_dest
 
boost::shared_ptr< ErrorLogerrorlog_p
 
std::vector< NamedDestination * > extern_dests
 
std::vector< boost::shared_ptr
< std::ofstream > > 
file_ps
 
boost::shared_ptr< PSetjob_pset_p
 
std::string jobReportOption
 
boost::shared_ptr< ThreadQueuem_queue
 
value_ptr< MessageLoggerDefaultsmessageLoggerDefaults
 
MsgContext msg_context
 
std::vector< Stringordinary_destination_filenames
 
bool purge_mode
 
bool singleThread
 
std::vector< ELdestControlstatisticsDestControls
 
std::vector< bool > statisticsResets
 
std::map< String, std::ostream * > stream_ps
 

Static Private Attributes

static ErrorLogstatic_errorlog_p
 

Detailed Description

Definition at line 86 of file MessageLoggerScribe.h.

Member Typedef Documentation

Definition at line 111 of file MessageLoggerScribe.h.

typedef std::string edm::service::MessageLoggerScribe::String
private

Definition at line 109 of file MessageLoggerScribe.h.

typedef std::vector<String> edm::service::MessageLoggerScribe::vString
private

Definition at line 110 of file MessageLoggerScribe.h.

Constructor & Destructor Documentation

edm::service::MessageLoggerScribe::MessageLoggerScribe ( boost::shared_ptr< ThreadQueue queue)
explicit

— If queue is NULL, this sets singleThread true

Definition at line 216 of file MessageLoggerScribe.cc.

References admin_p, msg_context, and edm::service::ELadministrator::setContextSupplier().

218 , early_dest( admin_p->attach(ELoutput(std::cerr, false)) )
219 , errorlog_p( new ErrorLog() )
220 , file_ps ( )
221 , job_pset_p( )
222 , extern_dests( )
223 , jobReportOption( )
225 , active( true )
226 , singleThread (queue.get() == 0) // changeLog 36
227 , done (false) // changeLog 32
228 , purge_mode (false) // changeLog 32
229 , count (false) // changeLog 32
230 , m_queue(queue) // changeLog 36
231 {
233 }
boost::shared_ptr< ErrorLog > errorlog_p
std::vector< boost::shared_ptr< std::ofstream > > file_ps
std::vector< NamedDestination * > extern_dests
boost::shared_ptr< ThreadQueue > m_queue
static ELadministrator * instance()
void setContextSupplier(const ELcontextSupplier &supplier)
boost::shared_ptr< PSet > job_pset_p
ELdestControl attach(const ELdestination &sink)
edm::service::MessageLoggerScribe::~MessageLoggerScribe ( )
virtual

Definition at line 235 of file MessageLoggerScribe.cc.

References admin_p, extern_dests, and edm::service::ELadministrator::finish().

236 {
237  admin_p->finish();
238  assert( extern_dests.empty() ); // nothing to do
239 }
std::vector< NamedDestination * > extern_dests

Member Function Documentation

void edm::service::MessageLoggerScribe::configure_default_fwkJobReport ( ELdestControl dest_ctrl)
private

Definition at line 767 of file MessageLoggerScribe.cc.

References edm::service::ELdestControl::setLimit(), edm::service::ELdestControl::setLineLength(), and edm::service::ELdestControl::suppressTime().

Referenced by configure_fwkJobReports().

768 {
769 
770  dest_ctrl.setLimit("*", 0 );
771  String msgID = "FwkJob";
772  int FwkJob_limit = 10000000;
773  dest_ctrl.setLimit(msgID, FwkJob_limit);
774  dest_ctrl.setLineLength(32000);
775  dest_ctrl.suppressTime();
776 
777 } // MessageLoggerScribe::configure_default_fwkJobReport()
void edm::service::MessageLoggerScribe::configure_dest ( ELdestControl dest_ctrl,
String const &  filename 
)
private

Definition at line 525 of file MessageLoggerScribe.cc.

References ecalBxOrbitNumberGrapher_cfg::categories, python.rootplot.argparse::category, edm::copy_all(), edm::MessageDrop::debugAlwaysSuppressed, edm::ELseverityLevel::ELsev_info, edm::ELseverityLevel::ELsev_success, edm::ELseverityLevel::ELsev_warning, lut2db_cfg::filename, edm::MessageDrop::infoAlwaysSuppressed, MergeJob_cfg::interval, job_pset_p, MessageLogger_cff::limit, messageLoggerDefaults, dtDQMClient_cfg::noLineBreaks, edm::service::ELdestControl::setInterval(), edm::service::ELdestControl::setLimit(), edm::service::ELdestControl::setLineLength(), edm::service::ELdestControl::setThreshold(), edm::service::ELdestControl::setTimespan(), AlCaHLTBitMon_QueryRunRegistry::string, edm::service::ELdestControl::suppressTime(), and edm::MessageDrop::warningAlwaysSuppressed.

Referenced by configure_external_dests(), configure_fwkJobReports(), configure_ordinary_destinations(), and configure_statistics().

528 {
529  static const int NO_VALUE_SET = -45654; // change log 2
530  vString empty_vString;
531  PSet empty_PSet;
532  String empty_String;
533 
534  // Defaults: // change log 3a
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; // change log 6
538  const int COMMON_DEFAULT_TIMESPAN = NO_VALUE_SET;
539 
540  char const* severity_array[] = {"WARNING", "INFO", "ERROR", "DEBUG"};
541  vString const severities(severity_array+0, severity_array+4);
542 
543  // grab list of categories
545  = getAparameter<vString>(*job_pset_p, "categories", empty_vString);
546 
547  // grab list of messageIDs -- these are a synonym for categories
548  // Note -- the use of messageIDs is deprecated in favor of categories
549  {
550  vString messageIDs
551  = getAparameter<vString>(*job_pset_p, "messageIDs", empty_vString);
552 
553  // combine the lists, not caring about possible duplicates (for now)
554  copy_all( messageIDs, std::back_inserter(categories) );
555  } // no longer need messageIDs
556 
557  // grab list of hardwired categories (hardcats) -- these are to be added
558  // to the list of categories -- change log 24
559  {
560  std::vector<std::string> hardcats = messageLoggerDefaults->categories;
561  // combine the lists, not caring about possible duplicates (for now)
562  copy_all( hardcats, std::back_inserter(categories) );
563  } // no longer need hardcats
564 
565  // grab default threshold common to all destinations
566  String default_threshold
567  = getAparameter<String>(*job_pset_p, "threshold", empty_String);
568  // change log 3a
569  // change log 24
570 
571  // grab default limit/interval/timespan common to all destinations/categories:
572  PSet default_pset
573  = getAparameter<PSet>(*job_pset_p, "default", empty_PSet);
574  int default_limit
575  = getAparameter<int>(default_pset, "limit", COMMON_DEFAULT_LIMIT);
576  int default_interval
577  = getAparameter<int>(default_pset, "reportEvery", COMMON_DEFAULT_INTERVAL);
578  // change log 6, 10
579  int default_timespan
580  = getAparameter<int>(default_pset, "timespan", COMMON_DEFAULT_TIMESPAN);
581  // change log 2a
582  // change log 3a
583  String default_pset_threshold
584  = getAparameter<String>(default_pset, "threshold", default_threshold);
585  // change log 34
586 
587  // grab all of this destination's parameters:
588  PSet dest_pset = getAparameter<PSet>(*job_pset_p, filename, empty_PSet);
589 
590  // See if this is just a placeholder // change log 9
591  bool is_placeholder
592  = getAparameter<bool>(dest_pset, "placeholder", false);
593  if (is_placeholder) return;
594 
595  // grab this destination's default limit/interval/timespan:
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);
602  // change log 6
603  int dest_default_timespan
604  = getAparameter<int>(dest_default_pset, "timespan", default_timespan);
605  // change log 1a
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 );
609  } // change log 1b, 2a, 2b
610  if ( dest_default_interval != NO_VALUE_SET ) { // change log 6
611  dest_ctrl.setInterval("*", dest_default_interval );
612  }
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 );
616  } // change log 1b, 2a, 2b
617 
618  // establish this destination's threshold:
619  String dest_threshold
620  = getAparameter<String>(dest_pset, "threshold", default_threshold);
621  if (dest_threshold == empty_String) {
622  dest_threshold = default_threshold;
623  }
624  if (dest_threshold == empty_String) { // change log 34
625  dest_threshold = default_pset_threshold;
626  }
627  if (dest_threshold == empty_String) {
628  dest_threshold = messageLoggerDefaults->threshold(filename);
629  }
630  if (dest_threshold == empty_String) dest_threshold = COMMON_DEFAULT_THRESHOLD;
631  ELseverityLevel threshold_sev(dest_threshold);
632  dest_ctrl.setThreshold(threshold_sev);
633  // change log 37
634  if (threshold_sev <= ELseverityLevel::ELsev_success)
636  if (threshold_sev <= ELseverityLevel::ELsev_info)
638  if (threshold_sev <= ELseverityLevel::ELsev_warning)
640 
641  // establish this destination's limit/interval/timespan for each category:
642  for( vString::const_iterator id_it = categories.begin()
643  ; id_it != categories.end()
644  ; ++id_it
645  )
646  {
647  String msgID = *id_it;
648  PSet default_category_pset
649  = getAparameter<PSet>(default_pset, msgID, empty_PSet); // change log 5
650  PSet category_pset
651  = getAparameter<PSet>(dest_pset, msgID, default_category_pset);
652 
653  int category_default_limit
654  = getAparameter<int>(default_category_pset, "limit", NO_VALUE_SET);
655  int limit
656  = getAparameter<int>(category_pset, "limit", category_default_limit);
657  if (limit == NO_VALUE_SET) limit = dest_default_limit;
658  // change log 7
659  int category_default_interval
660  = getAparameter<int>(default_category_pset, "reportEvery", NO_VALUE_SET);
661  int interval
662  = getAparameter<int>(category_pset, "reportEvery",category_default_interval);
663  if (interval == NO_VALUE_SET) interval = dest_default_interval;
664  // change log 6 and then 7
665  int category_default_timespan
666  = getAparameter<int>(default_category_pset, "timespan", NO_VALUE_SET);
667  int timespan
668  = getAparameter<int>(category_pset, "timespan", category_default_timespan);
669  if (timespan == NO_VALUE_SET) timespan = dest_default_timespan;
670  // change log 7
671 
672  std::string category = msgID;
673  if ( limit == NO_VALUE_SET ) { // change log 24
674  limit = messageLoggerDefaults->limit(filename,category);
675  }
676  if ( interval == NO_VALUE_SET ) { // change log 24
677  interval = messageLoggerDefaults->reportEvery(filename,category);
678  }
679  if ( timespan == NO_VALUE_SET ) { // change log 24
680  timespan = messageLoggerDefaults->timespan(filename,category);
681  }
682 
683  if( limit != NO_VALUE_SET ) {
684  if ( limit < 0 ) limit = 2000000000;
685  dest_ctrl.setLimit(msgID, limit);
686  } // change log 2a, 2b
687  if( interval != NO_VALUE_SET ) {
688  dest_ctrl.setInterval(msgID, interval);
689  } // change log 6
690  if( timespan != NO_VALUE_SET ) {
691  if ( timespan < 0 ) timespan = 2000000000;
692  dest_ctrl.setTimespan(msgID, timespan);
693  } // change log 2a, 2b
694 
695  } // for
696 
697  // establish this destination's limit for each severity:
698  for( vString::const_iterator sev_it = severities.begin()
699  ; sev_it != severities.end()
700  ; ++sev_it
701  )
702  {
703  String sevID = *sev_it;
704  ELseverityLevel severity(sevID);
705  PSet default_sev_pset
706  = getAparameter<PSet>(default_pset, sevID, empty_PSet);
707  PSet sev_pset
708  = getAparameter<PSet>(dest_pset, sevID, default_sev_pset);
709  // change log 5
710  int limit = getAparameter<int>(sev_pset, "limit", NO_VALUE_SET);
711  if ( limit == NO_VALUE_SET ) { // change log 24
712  limit = messageLoggerDefaults->sev_limit(filename,sevID);
713  }
714  if( limit != NO_VALUE_SET ) {
715  if (limit < 0) limit = 2000000000; // change log 38
716  dest_ctrl.setLimit(severity, limit );
717  }
718  int interval = getAparameter<int>(sev_pset, "reportEvery", NO_VALUE_SET);
719  if ( interval == NO_VALUE_SET ) { // change log 24
720  interval = messageLoggerDefaults->sev_reportEvery(filename,sevID);
721  }
722  if( interval != NO_VALUE_SET ) dest_ctrl.setInterval(severity, interval);
723  // change log 2
724  int timespan = getAparameter<int>(sev_pset, "timespan", NO_VALUE_SET);
725  if ( timespan == NO_VALUE_SET ) { // change log 24
726  timespan = messageLoggerDefaults->sev_timespan(filename,sevID);
727  }
728  if( timespan != NO_VALUE_SET ) {
729  if (timespan < 0) timespan = 2000000000; // change log 38
730  dest_ctrl.setTimespan(severity, timespan );
731  }
732  } // for
733 
734  // establish this destination's linebreak policy:
735  bool noLineBreaks_default
736  = getAparameter<bool> (default_pset, "noLineBreaks", false);
737  // change log 5
738  bool noLineBreaks
739  = getAparameter<bool> (dest_pset, "noLineBreaks", noLineBreaks_default);
740  if (noLineBreaks) {
741  dest_ctrl.setLineLength(32000);
742  }
743  else {
744  int lenDef = 80;
745  int lineLen_default
746  = getAparameter<int> (default_pset, "lineLength", lenDef);
747  // change log 5
748  int lineLen = getAparameter<int> (dest_pset, "lineLength", lineLen_default);
749  if (lineLen != lenDef) {
750  dest_ctrl.setLineLength(lineLen);
751  }
752  }
753 
754  // if indicated, suppress time stamps in this destination's output
755  bool suppressTime_default
756  = getAparameter<bool> (default_pset, "noTimeStamps", false);
757  bool suppressTime
758  = getAparameter<bool> (dest_pset, "noTimeStamps", suppressTime_default);
759  if (suppressTime) {
760  dest_ctrl.suppressTime();
761  }
762 
763 } // MessageLoggerScribe::configure_dest()
tuple interval
Definition: MergeJob_cfg.py:20
static bool debugAlwaysSuppressed
Definition: MessageDrop.h:111
static bool warningAlwaysSuppressed
Definition: MessageDrop.h:113
boost::shared_ptr< PSet > job_pset_p
Func copy_all(ForwardSequence &s, Func f)
wrappers for copy
Definition: Algorithms.h:24
tuple filename
Definition: lut2db_cfg.py:20
static bool infoAlwaysSuppressed
Definition: MessageDrop.h:112
value_ptr< MessageLoggerDefaults > messageLoggerDefaults
void edm::service::MessageLoggerScribe::configure_errorlog ( )
private

Definition at line 480 of file MessageLoggerScribe.cc.

References clean_slate_configuration, configure_external_dests(), configure_fwkJobReports(), configure_ordinary_destinations(), configure_statistics(), early_dest, job_pset_p, log(), edm::MessageLoggerQ::LOG_A_MESSAGE, m_queue, singleThread, stream_ps, and edm::service::ELdestControl::suppressTime().

Referenced by runCommand().

481 {
482  vString empty_vString;
483  String empty_String;
484  PSet empty_PSet;
485 
486  // The following is present to test pre-configuration message handling:
487  String preconfiguration_message
488  = getAparameter<String>
489  (*job_pset_p, "generate_preconfiguration_message", empty_String);
490  if (preconfiguration_message != empty_String) {
491  // To test a preconfiguration message without first going thru the
492  // configuration we are about to do, we issue the message (so it sits
493  // on the queue), then copy the processing that the LOG_A_MESSAGE case
494  // does. We suppress the timestamp to allow for automated unit testing.
496  LogError ("preconfiguration") << preconfiguration_message;
497  if (!singleThread) {
498  MessageLoggerQ::OpCode opcode;
499  void * operand;
500  m_queue->consume(opcode, operand); // grab next work item from Q
501  assert (opcode == MessageLoggerQ::LOG_A_MESSAGE);
502  ErrorObj * errorobj_p = static_cast<ErrorObj *>(operand);
503  log (errorobj_p);
504  delete errorobj_p; // dispose of the message text
505  }
506  }
507 
508  if ( !stream_ps.empty() ) {
509  LogWarning ("multiLogConfig")
510  << "The message logger has been configured multiple times";
511  clean_slate_configuration = false; // Change Log 22
512  }
513  configure_fwkJobReports(); // Change Log 16
514  configure_ordinary_destinations(); // Change Log 16
515  configure_statistics(); // Change Log 16
516 
518 
519 } // MessageLoggerScribe::configure_errorlog()
boost::shared_ptr< ThreadQueue > m_queue
boost::shared_ptr< PSet > job_pset_p
std::map< String, std::ostream * > stream_ps
void edm::service::MessageLoggerScribe::configure_external_dests ( )
private

Definition at line 1176 of file MessageLoggerScribe.cc.

References admin_p, edm::service::ELadministrator::attach(), configure_dest(), extern_dests, and job_pset_p.

Referenced by configure_errorlog(), and runCommand().

1177 {
1178  if( ! job_pset_p )
1179  {
1180 // extern_dests.clear();
1181 // change log 12, removed by change log 13
1182  return;
1183  }
1184 
1185  for( std::vector<NamedDestination*>::const_iterator it = extern_dests.begin()
1186  ; it != extern_dests.end()
1187  ; ++it
1188  )
1189  {
1190  ELdestination * dest_p = (*it)->dest_p().get();
1191  ELdestControl dest_ctrl = admin_p->attach( *dest_p );
1192 
1193  // configure the newly-attached destination:
1194  configure_dest( dest_ctrl, (*it)->name() );
1195  delete *it; // dispose of our (copy of the) NamedDestination
1196  }
1197  extern_dests.clear();
1198 
1199 } // MessageLoggerScribe::configure_external_dests
std::vector< NamedDestination * > extern_dests
void configure_dest(ELdestControl &dest_ctrl, String const &filename)
boost::shared_ptr< PSet > job_pset_p
ELdestControl attach(const ELdestination &sink)
void edm::service::MessageLoggerScribe::configure_fwkJobReports ( )
private

Definition at line 781 of file MessageLoggerScribe.cc.

References admin_p, edm::service::ELadministrator::attach(), clean_slate_configuration, edm::errors::Configuration, configure_default_fwkJobReport(), configure_dest(), edm::hlt::Exception, file_ps, lut2db_cfg::filename, benchmark_cfg::fwkJobReports, job_pset_p, jobReportOption, messageLoggerDefaults, stream_ps, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by configure_errorlog().

782 {
783  vString empty_vString;
784  String empty_String;
785  PSet empty_PSet;
786 
787  // decide whether to configure any job reports at all // Changelog 19
788  bool jobReportExists = false;
789  bool enableJobReports = false;
790  #ifdef DEFINE_THIS_TO_MAKE_REPORTS_THE_DEFAULT
791  enableJobReports = true;
792  #endif
793  if (jobReportOption != empty_String) enableJobReports = true;
794  if (jobReportOption == "~") enableJobReports = false; // --nojobReport
795  if (!enableJobReports) return;
796 
797  if ((jobReportOption != "*") && (jobReportOption != empty_String)) {
798  const std::string::size_type npos = std::string::npos;
799  if ( jobReportOption.find('.') == npos ) {
800  jobReportOption += ".xml";
801  }
802  }
803 
804  // grab list of fwkJobReports:
806  = getAparameter<vString>(*job_pset_p, "fwkJobReports", empty_vString);
807 
808  // Use the default list of fwkJobReports if and only if the grabbed list is
809  // empty // change log 24
810  if (fwkJobReports.empty()) {
811  fwkJobReports = messageLoggerDefaults->fwkJobReports;
812  }
813 
814  // establish each fwkJobReports destination:
815  for( vString::const_iterator it = fwkJobReports.begin()
816  ; it != fwkJobReports.end()
817  ; ++it
818  )
819  {
820  String filename = *it;
821  String psetname = filename;
822 
823  // check that this destination is not just a placeholder // change log 20
824  PSet fjr_pset = getAparameter<PSet>(*job_pset_p, psetname, empty_PSet);
825  bool is_placeholder
826  = getAparameter<bool>(fjr_pset, "placeholder", false);
827  if (is_placeholder) continue;
828 
829  // Modify the file name if extension or name is explicitly specified
830  // change log 14
831  String explicit_filename
832  = getAparameter<String>(fjr_pset, "filename", empty_String);
833  if (explicit_filename != empty_String) filename = explicit_filename;
834  String explicit_extension
835  = getAparameter<String>(fjr_pset, "extension", empty_String);
836  if (explicit_extension != empty_String) {
837  if (explicit_extension[0] == '.') {
838  filename += explicit_extension;
839  } else {
840  filename = filename + "." + explicit_extension;
841  }
842  }
843 
844  // Attach a default extension of .xml if there is no extension on a file
845  std::string actual_filename = filename; // change log 4
846  const std::string::size_type npos = std::string::npos;
847  if ( filename.find('.') == npos ) {
848  actual_filename += ".xml";
849  }
850 
851  // Check that this is not a duplicate name // change log 18
852  if ( stream_ps.find(actual_filename)!=stream_ps.end() ) {
853  if (clean_slate_configuration) { // change log 22
855  <<"Duplicate name for a MessageLogger Framework Job Report Destination: "
856  << actual_filename
857  << "\n";
858  } else {
859  LogWarning("duplicateDestination")
860  <<"Duplicate name for a MessageLogger Framework Job Report Destination: "
861  << actual_filename
862  << "\n" << "Only original configuration instructions are used";
863  continue;
864  }
865  }
866 
867  jobReportExists = true; // Changelog 19
868  if ( actual_filename == jobReportOption ) jobReportOption = empty_String;
869 
870  boost::shared_ptr<std::ofstream> os_sp(new std::ofstream(actual_filename.c_str()));
871  file_ps.push_back(os_sp);
872  ELdestControl dest_ctrl;
873  dest_ctrl = admin_p->attach( ELfwkJobReport(*os_sp) );
874  stream_ps[actual_filename] = os_sp.get();
875 
876  // now configure this destination:
877  configure_dest(dest_ctrl, psetname);
878 
879  } // for [it = fwkJobReports.begin() to end()]
880 
881  // Now possibly add the file specified by --jobReport // Changelog 19
882  if (jobReportOption==empty_String) return;
883  if (jobReportExists && ( jobReportOption=="*" )) return;
884  if (jobReportOption=="*") jobReportOption = "FrameworkJobReport.xml";
885  // Check that this report is not already on order -- here the duplicate
886  // name would not be a configuration error, but we shouldn't do it twice
887  std::string actual_filename = jobReportOption;
888  if ( stream_ps.find(actual_filename)!=stream_ps.end() ) return;
889 
890  boost::shared_ptr<std::ofstream> os_sp(new std::ofstream(actual_filename.c_str()));
891  file_ps.push_back(os_sp);
892  ELdestControl dest_ctrl;
893  dest_ctrl = admin_p->attach( ELfwkJobReport(*os_sp) );
894  stream_ps[actual_filename] = os_sp.get();
895 
896  // now configure this destination, in the jobreport default manner:
897  configure_default_fwkJobReport (dest_ctrl);
898 
899 }
void configure_default_fwkJobReport(ELdestControl &dest_ctrl)
std::vector< boost::shared_ptr< std::ofstream > > file_ps
uint16_t size_type
void configure_dest(ELdestControl &dest_ctrl, String const &filename)
boost::shared_ptr< PSet > job_pset_p
tuple filename
Definition: lut2db_cfg.py:20
std::map< String, std::ostream * > stream_ps
ELdestControl attach(const ELdestination &sink)
value_ptr< MessageLoggerDefaults > messageLoggerDefaults
void edm::service::MessageLoggerScribe::configure_ordinary_destinations ( )
private

Definition at line 902 of file MessageLoggerScribe.cc.

References admin_p, edm::service::ELadministrator::attach(), dtNoiseDBValidation_cfg::cerr, clean_slate_configuration, configure_dest(), gather_cfg::cout, edm::MessageDrop::debugAlwaysSuppressed, gather_cfg::destinations, early_dest, edm::ELhighestSeverity, edm::ELzeroSeverity, file_ps, lut2db_cfg::filename, edm::MessageDrop::infoAlwaysSuppressed, job_pset_p, messageLoggerDefaults, ordinary_destination_filenames, edm::service::ELdestControl::setThreshold(), stream_ps, AlCaHLTBitMon_QueryRunRegistry::string, and edm::MessageDrop::warningAlwaysSuppressed.

Referenced by configure_errorlog().

903 {
904  vString empty_vString;
905  String empty_String;
906  PSet empty_PSet;
907 
908  // Initialize unversal suppression variables
909  MessageDrop::debugAlwaysSuppressed=true; // change log 37
910  MessageDrop::infoAlwaysSuppressed=true; // change log 37
911  MessageDrop::warningAlwaysSuppressed=true; // change log 37
912 
913  // grab list of destinations:
915  = getAparameter<vString>(*job_pset_p, "destinations", empty_vString);
916 
917  // Use the default list of destinations if and only if the grabbed list is
918  // empty // change log 24
919  if (destinations.empty()) {
920  destinations = messageLoggerDefaults->destinations;
921  }
922 
923  // dial down the early destination if other dest's are supplied:
924  if( ! destinations.empty() )
926 
927  // establish each destination:
928  for( vString::const_iterator it = destinations.begin()
929  ; it != destinations.end()
930  ; ++it
931  )
932  {
933  String filename = *it;
934  String psetname = filename;
935 
936  // check that this destination is not just a placeholder // change log 11
937  PSet dest_pset = getAparameter<PSet>(*job_pset_p, psetname, empty_PSet);
938  bool is_placeholder
939  = getAparameter<bool>(dest_pset, "placeholder", false);
940  if (is_placeholder) continue;
941 
942  // Modify the file name if extension or name is explicitly specified
943  // change log 14
944 
945  // Although for an ordinary destination there is no output attribute
946  // for the cfg (you can use filename instead) we provide output() for
947  // uniformity with the statistics destinations. The "right way" to
948  // work this would have been to provide a filename() method, along with
949  // an extension() method. We recognize the potential name confusion here
950  // (filename(filename))!
951 
952  // Determine the destination file name to use if no explicit filename is
953  // supplied in the cfg.
954  String filename_default
955  = getAparameter<String>(dest_pset, "output", empty_String);
956  if ( filename_default == empty_String ) {
957  filename_default = messageLoggerDefaults->output(psetname); // change log 31
958  if (filename_default == empty_String) {
959  filename_default = filename;
960  }
961  }
962 
963  String explicit_filename
964  = getAparameter<String>(dest_pset, "filename", filename_default);
965  if (explicit_filename != empty_String) filename = explicit_filename;
966  String explicit_extension
967  = getAparameter<String>(dest_pset, "extension", empty_String);
968  if (explicit_extension != empty_String) {
969  if (explicit_extension[0] == '.') {
970  filename += explicit_extension;
971  } else {
972  filename = filename + "." + explicit_extension;
973  }
974  }
975 
976  // Attach a default extension of .log if there is no extension on a file
977  // change log 18 - this had been done in concert with attaching destination
978 
979  std::string actual_filename = filename; // change log 4
980  if ( (filename != "cout") && (filename != "cerr") ) {
981  const std::string::size_type npos = std::string::npos;
982  if ( filename.find('.') == npos ) {
983  actual_filename += ".log";
984  }
985  }
986 
987  // Check that this is not a duplicate name // change log 18
988  if ( stream_ps.find(actual_filename)!=stream_ps.end() ) {
989  if (clean_slate_configuration) { // change log 22
990 // throw edm::Exception ( edm::errors::Configuration )
991  LogError("duplicateDestination") // change log 35
992  <<"Duplicate name for a MessageLogger Destination: "
993  << actual_filename
994  << "\n" << "Only the first configuration instructions are used";
995  continue;
996  } else {
997  LogWarning("duplicateDestination")
998  <<"Duplicate name for a MessageLogger Destination: "
999  << actual_filename
1000  << "\n" << "Only original configuration instructions are used";
1001  continue;
1002  }
1003  }
1004 
1005  ordinary_destination_filenames.push_back(actual_filename);
1006 
1007  // attach the current destination, keeping a control handle to it:
1008  ELdestControl dest_ctrl;
1009  if( actual_filename == "cout" ) {
1010  dest_ctrl = admin_p->attach( ELoutput(std::cout) );
1011  stream_ps["cout"] = &std::cout;
1012  }
1013  else if( actual_filename == "cerr" ) {
1015  dest_ctrl = early_dest;
1016  stream_ps["cerr"] = &std::cerr;
1017  }
1018  else {
1019  boost::shared_ptr<std::ofstream> os_sp(new std::ofstream(actual_filename.c_str()));
1020  file_ps.push_back(os_sp);
1021  dest_ctrl = admin_p->attach( ELoutput(*os_sp) );
1022  stream_ps[actual_filename] = os_sp.get();
1023  }
1024  //(*errorlog_p)( ELinfo, "added_dest") << filename << endmsg;
1025 
1026  // now configure this destination:
1027  configure_dest(dest_ctrl, psetname);
1028 
1029  } // for [it = destinations.begin() to end()]
1030 
1031 } // configure_ordinary_destinations
virtual ELdestControl & setThreshold(const ELseverityLevel &sv)
std::vector< boost::shared_ptr< std::ofstream > > file_ps
ELslProxy< ELhighestSeverityGen > const ELhighestSeverity
uint16_t size_type
std::vector< String > ordinary_destination_filenames
static bool debugAlwaysSuppressed
Definition: MessageDrop.h:111
ELslProxy< ELzeroSeverityGen > const ELzeroSeverity
void configure_dest(ELdestControl &dest_ctrl, String const &filename)
static bool warningAlwaysSuppressed
Definition: MessageDrop.h:113
boost::shared_ptr< PSet > job_pset_p
tuple filename
Definition: lut2db_cfg.py:20
tuple destinations
Definition: gather_cfg.py:120
std::map< String, std::ostream * > stream_ps
tuple cout
Definition: gather_cfg.py:121
ELdestControl attach(const ELdestination &sink)
static bool infoAlwaysSuppressed
Definition: MessageDrop.h:112
value_ptr< MessageLoggerDefaults > messageLoggerDefaults
void edm::service::MessageLoggerScribe::configure_statistics ( )
private

Definition at line 1035 of file MessageLoggerScribe.cc.

References admin_p, edm::service::ELadministrator::attach(), dtNoiseDBValidation_cfg::cerr, clean_slate_configuration, edm::errors::Configuration, configure_dest(), gather_cfg::cout, gather_cfg::destinations, edm::hlt::Exception, file_ps, lut2db_cfg::filename, job_pset_p, messageLoggerDefaults, edm::service::ELdestControl::noTerminationSummary(), ordinary_destination_filenames, reset(), edm::search_all(), benchmark_cfg::statistics, statisticsDestControls, statisticsResets, stream_ps, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by configure_errorlog().

1036 {
1037  vString empty_vString;
1038  String empty_String;
1039  PSet empty_PSet;
1040 
1041  // grab list of statistics destinations:
1043  = getAparameter<vString>(*job_pset_p, "statistics", empty_vString);
1044 
1045  bool no_statistics_configured = statistics.empty(); // change log 24
1046 
1047  if ( no_statistics_configured ) {
1048  // Read the list of staistics destinations from hardwired defaults,
1049  // but only if there is also no list of ordinary destinations.
1050  // (If a cfg specifies destinations, and no statistics, assume that
1051  // is what the user wants.)
1053  = getAparameter<vString>(*job_pset_p, "destinations", empty_vString);
1054  if (destinations.empty()) {
1055  statistics = messageLoggerDefaults->statistics;
1056  no_statistics_configured = statistics.empty();
1057  }
1058  }
1059 
1060  // establish each statistics destination:
1061  for( vString::const_iterator it = statistics.begin()
1062  ; it != statistics.end()
1063  ; ++it
1064  )
1065  {
1066  String statname = *it;
1067  String psetname = statname;
1068 
1069  // check that this destination is not just a placeholder // change log 20
1070  PSet stat_pset = getAparameter<PSet>(*job_pset_p, psetname, empty_PSet);
1071  bool is_placeholder
1072  = getAparameter<bool>(stat_pset, "placeholder", false);
1073  if (is_placeholder) continue;
1074 
1075  // Determine the destination file name
1076  String filename
1077  = getAparameter<String>(stat_pset, "output", empty_String);
1078  if ( filename == empty_String ) {
1079  filename = messageLoggerDefaults->output(psetname); // change log 31
1080  if (filename == empty_String) {
1081  filename = statname;
1082  }
1083  }
1084 
1085  // Modify the file name if extension or name is explicitly specified
1086  // change log 14 -- probably suspenders and a belt, because ouput option
1087  // is present, but uniformity is nice.
1088 
1089  String explicit_filename
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;
1097  } else {
1098  filename = filename + "." + explicit_extension;
1099  }
1100  }
1101 
1102  // Attach a default extension of .log if there is no extension on a file
1103  // change log 18 - this had been done in concert with attaching destination
1104 
1105  std::string actual_filename = filename; // change log 4
1106  if ( (filename != "cout") && (filename != "cerr") ) { // change log 23
1107  const std::string::size_type npos = std::string::npos;
1108  if ( filename.find('.') == npos ) {
1109  actual_filename += ".log";
1110  }
1111  }
1112 
1113  // Check that this is not a duplicate name -
1114  // unless it is an ordinary destination (which stats can share)
1115  if ( !search_all(ordinary_destination_filenames, actual_filename) ) {
1116  if ( stream_ps.find(actual_filename)!=stream_ps.end() ) {
1117  if (clean_slate_configuration) { // change log 22
1119  <<"Duplicate name for a MessageLogger Statistics Destination: "
1120  << actual_filename
1121  << "\n";
1122  } else {
1123  LogWarning("duplicateDestination")
1124  <<"Duplicate name for a MessageLogger Statistics Destination: "
1125  << actual_filename
1126  << "\n" << "Only original configuration instructions are used";
1127  continue;
1128  }
1129  }
1130  }
1131 
1132  // create (if statistics file does not match any destination file name)
1133  // or note (if statistics file matches a destination file name) the ostream.
1134  // But if no statistics destinations were provided in the config, do not
1135  // create a new destination for this hardwired statistics - only act if
1136  // it is matches a destination. (shange log 24)
1137  bool statistics_destination_is_real = !no_statistics_configured;
1138  std::ostream* os_p;
1139  if ( stream_ps.find(actual_filename) == stream_ps.end() ) {
1140  if ( actual_filename == "cout" ) {
1141  os_p = &std::cout;
1142  } else if ( actual_filename == "cerr" ) {
1143  os_p = &std::cerr;
1144  } else {
1145  boost::shared_ptr<std::ofstream> os_sp(new std::ofstream(actual_filename.c_str()));
1146  file_ps.push_back(os_sp);
1147  os_p = os_sp.get();
1148  }
1149  stream_ps[actual_filename] = os_p;
1150  } else {
1151  statistics_destination_is_real = true; // change log 24
1152  os_p = stream_ps[actual_filename];
1153  }
1154 
1155  if (statistics_destination_is_real) { // change log 24
1156  // attach the statistics destination, keeping a control handle to it:
1157  ELdestControl dest_ctrl;
1158  dest_ctrl = admin_p->attach( ELstatistics(*os_p) );
1159  statisticsDestControls.push_back(dest_ctrl);
1160  bool reset = getAparameter<bool>(stat_pset, "reset", false);
1161  statisticsResets.push_back(reset);
1162 
1163  // now configure this destination:
1164  configure_dest(dest_ctrl, psetname);
1165 
1166  // and suppress the desire to do an extra termination summary just because
1167  // of end-of-job info messages
1168  dest_ctrl.noTerminationSummary();
1169  }
1170 
1171  } // for [it = statistics.begin() to end()]
1172 
1173 } // configure_statistics
std::vector< boost::shared_ptr< std::ofstream > > file_ps
uint16_t size_type
std::vector< String > ordinary_destination_filenames
void configure_dest(ELdestControl &dest_ctrl, String const &filename)
std::vector< ELdestControl > statisticsDestControls
bool search_all(ForwardSequence const &s, Datum const &d)
Definition: Algorithms.h:46
boost::shared_ptr< PSet > job_pset_p
tuple filename
Definition: lut2db_cfg.py:20
tuple destinations
Definition: gather_cfg.py:120
std::map< String, std::ostream * > stream_ps
tuple cout
Definition: gather_cfg.py:121
ELdestControl attach(const ELdestination &sink)
void reset(double vett[256])
Definition: TPedValues.cc:11
value_ptr< MessageLoggerDefaults > messageLoggerDefaults
template<class T >
T edm::service::MessageLoggerScribe::getAparameter ( PSet const &  p,
std::string const &  id,
T const &  def 
)
inlineprivate

Definition at line 162 of file MessageLoggerScribe.h.

References def, and lumiQTWidget::t.

163  {
164  T t = def;
165  try {
166  t = p.template getUntrackedParameter<T>(id, def);
167  } catch (...) {
168  try {
169  t = p.template getParameter<T>(id);
170  } catch (...) {
171  // Since PSetValidation will catch such errors, we simply proceed as
172  // best we can in case we are setting up the logger just to contain the
173  // validation-caught error messages.
174  }
175  }
176  return t;
177  }
long double T
JetCorrectorParameters::Definitions def
Definition: classes.h:12
static ErrorLog* edm::service::MessageLoggerScribe::getErrorLog_ptr ( )
inlinestatic

Definition at line 105 of file MessageLoggerScribe.h.

References static_errorlog_p.

105 {return static_errorlog_p;}
void edm::service::MessageLoggerScribe::log ( ErrorObj errorobj_p)
private

Definition at line 466 of file MessageLoggerScribe.cc.

References admin_p, ecalBxOrbitNumberGrapher_cfg::categories, edm::ErrorObj::context(), fwrapper::cs, edm::service::ELadministrator::getContextSupplier(), edm::ELextendedID::id, parseCategories(), edm::service::MsgContext::setContext(), edm::ErrorObj::setID(), and edm::ErrorObj::xid().

Referenced by configure_errorlog(), and runCommand().

466  {
467  ELcontextSupplier& cs =
468  const_cast<ELcontextSupplier&>(admin_p->getContextSupplier());
469  MsgContext& mc = dynamic_cast<MsgContext&>(cs);
470  mc.setContext(errorobj_p->context());
471  std::vector<std::string> categories;
472  parseCategories(errorobj_p->xid().id, categories);
473  for (unsigned int icat = 0; icat < categories.size(); ++icat) {
474  errorobj_p->setID(categories[icat]);
475  (*errorlog_p)( *errorobj_p ); // route the message text
476  }
477 }
const ELcontextSupplier & getContextSupplier() const
auto_ptr< ClusterSequence > cs
void parseCategories(std::string const &s, std::vector< std::string > &cats)
void edm::service::MessageLoggerScribe::parseCategories ( std::string const &  s,
std::vector< std::string > &  cats 
)
private

Definition at line 1202 of file MessageLoggerScribe.cc.

References i, and j.

Referenced by log().

1204 {
1205  const std::string::size_type npos = std::string::npos;
1207  while ( i != npos ) {
1208  std::string::size_type j = s.find('|',i);
1209  cats.push_back (s.substr(i,j-i));
1210  i = j;
1211  while ( (i != npos) && (s[i] == '|') ) ++i;
1212  // the above handles cases of || and also | at end of string
1213  }
1214  // Note: This algorithm assigns, as desired, one null category if it
1215  // encounters an empty categories string
1216 }
int i
Definition: DBlmapReader.cc:9
uint16_t size_type
int j
Definition: DBlmapReader.cc:9
void edm::service::MessageLoggerScribe::run ( void  )
virtual

Definition at line 243 of file MessageLoggerScribe.cc.

References done, edm::MessageDrop::instance(), m_queue, edm::MessageDrop::messageLoggerScribeIsRunning, edm::MLSCRIBE_RUNNING_INDICATOR, and runCommand().

Referenced by Types.LuminosityBlockID::cppID().

244 {
245  MessageLoggerQ::OpCode opcode;
246  void * operand;
247 
249  MLSCRIBE_RUNNING_INDICATOR; // ChangeLog 30
250 // std::cerr << "MessageLoggerScribe::run(): \n";
251 // std::cerr << "messageLoggerScribeIsRunning = "
252 // << (int)MessageDrop::instance()->messageLoggerScribeIsRunning << "\n";
253 
254  do {
255  m_queue->consume(opcode, operand); // grab next work item from Q
256  // changeLog 36
257  runCommand (opcode, operand);
258  } while(! done);
259 
260 } // MessageLoggerScribe::run()
static unsigned char messageLoggerScribeIsRunning
Definition: MessageDrop.h:109
virtual void runCommand(MessageLoggerQ::OpCode opcode, void *operand)
static MessageDrop * instance()
Definition: MessageDrop.cc:65
static const unsigned char MLSCRIBE_RUNNING_INDICATOR
Definition: MessageDrop.h:121
boost::shared_ptr< ThreadQueue > m_queue
void edm::service::MessageLoggerScribe::runCommand ( MessageLoggerQ::OpCode  opcode,
void *  operand 
)
virtual

Reimplemented from edm::service::AbstractMLscribe.

Definition at line 263 of file MessageLoggerScribe.cc.

References active, edm::ConfigurationHandshake::c, dtNoiseDBValidation_cfg::cerr, edm::MessageLoggerQ::CONFIGURE, configure_errorlog(), configure_external_dests(), count, done, alignCSCRings::e, edm::MessageLoggerQ::END_THREAD, edm::ConfigurationHandshake::epp, edm::hlt::Exception, edm::MessageLoggerQ::EXTERN_DEST, extern_dests, edm::MessageLoggerQ::FJR_SUMMARY, edm::MessageLoggerQ::FLUSH_LOG_Q, edm::MessageLoggerQ::GROUP_STATS, edm::MessageDrop::instance(), job_pset_p, edm::MessageLoggerQ::JOBMODE, edm::MessageLoggerQ::JOBREPORT, jobReportOption, log(), edm::MessageLoggerQ::LOG_A_MESSAGE, edm::ConfigurationHandshake::m, messageLoggerDefaults, edm::MessageDrop::messageLoggerScribeIsRunning, edm::service::MessageLoggerDefaults::mode(), edm::service::ELstatistics::noteGroupedCategory(), edm::ConfigurationHandshake::p, purge_mode, edm::MessageLoggerQ::SHUT_UP, singleThread, AlCaHLTBitMon_QueryRunRegistry::string, edm::MessageLoggerQ::SUMMARIZE, triggerFJRmessageSummary(), triggerStatisticsSummaries(), and cms::Exception::what().

Referenced by run().

266 {
267  switch(opcode) { // interpret the work item
268  default: {
269  assert(false); // can't happen (we certainly hope!)
270  break;
271  }
273  assert( operand == 0 );
274  done = true;
276  (unsigned char) -1; // ChangeLog 30
277  break;
278  }
280  ErrorObj * errorobj_p = static_cast<ErrorObj *>(operand);
281  try {
282  if(active && !purge_mode) log (errorobj_p);
283  }
284  catch(cms::Exception& e)
285  {
286  ++count;
287  std::cerr << "MessageLoggerScribe caught " << count
288  << " cms::Exceptions, text = \n"
289  << e.what() << "\n";
290 
291  if(count > 25)
292  {
293  cerr << "MessageLogger will no longer be processing "
294  << "messages due to errors (entering purge mode).\n";
295  purge_mode = true;
296  }
297  }
298  catch(...)
299  {
300  std::cerr << "MessageLoggerScribe caught an unknown exception and "
301  << "will no longer be processing "
302  << "messages. (entering purge mode)\n";
303  purge_mode = true;
304  }
305  delete errorobj_p; // dispose of the message text
306  break;
307  }
308  case MessageLoggerQ::CONFIGURE: { // changelog 17
309  if (singleThread) {
310  job_pset_p.reset(static_cast<ParameterSet *>(operand));
312  break;
313  } else {
314  ConfigurationHandshake * h_p =
315  static_cast<ConfigurationHandshake *>(operand);
316  job_pset_p.reset(static_cast<ParameterSet *>(h_p->p));
317  boost::mutex::scoped_lock sl(h_p->m); // get lock
318  try {
320  }
321  catch(edm::Exception& e)
322  {
323  Place_for_passing_exception_ptr epp = h_p->epp;
324  if (!(*epp)) {
325  *epp = boost::shared_ptr<edm::Exception>(new edm::Exception(e));
326  } else {
328  (*ep) << "\n and another exception: \n" << e.what();
329  }
330  }
331  // Note - since the configuring code has not made a new copy of the
332  // job parameter set, we must not delete job_pset_p (in contrast to
333  // the case for errorobj_p). On the other hand, if we instantiate
334  // a new edm::Exception pointed to by *epp, it is the responsibility
335  // of the MessageLoggerQ to delete it.
336  h_p->c.notify_all(); // Signal to MessageLoggerQ that we are done
337  // finally, release the scoped lock by letting it go out of scope
338  break;
339  }
340  }
342  try {
343  extern_dests.push_back( static_cast<NamedDestination *>(operand) );
345  }
346  catch(cms::Exception& e) // change log 21
347  {
348  std::cerr << "MessageLoggerScribe caught a cms::Exception "
349  << "during extern dest configuration:\n"
350  << e.what() << "\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";
354  }
355  catch(...) // change log 21
356  {
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";
362  }
363  break;
364  }
366  assert( operand == 0 );
367  try {
369  }
370  catch(cms::Exception& e)
371  {
372  std::cerr << "MessageLoggerScribe caught exception "
373  << "during summarize:\n"
374  << e.what() << "\n";
375  }
376  catch(...)
377  {
378  std::cerr << "MessageLoggerScribe caught unkonwn exception type "
379  << "during summarize. (Ignored)\n";
380  }
381  break;
382  }
383  case MessageLoggerQ::JOBREPORT: { // change log 19
384  std::string* jobReportOption_p =
385  static_cast<std::string*>(operand);
386  try {
387  jobReportOption = *jobReportOption_p;
388  }
389  catch(cms::Exception& e)
390  {
391  std::cerr << "MessageLoggerScribe caught a cms::Exception "
392  << "during processing of --jobReport option:\n"
393  << e.what() << "\n"
394  << "This likely will affect or prevent the job report.\n"
395  << "However, the rest of the logger continues to run.\n";
396  }
397  catch(...)
398  {
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";
403  }
404  delete jobReportOption_p; // dispose of the message text
405  // which will have been new-ed
406  // in MessageLogger.cc (service version)
407  break;
408  }
409  case MessageLoggerQ::JOBMODE: { // change log 24
410  std::string* jobMode_p =
411  static_cast<std::string*>(operand);
412  JobMode jm = MessageLoggerDefaults::mode(*jobMode_p);
414  value_ptr<MessageLoggerDefaults>(new MessageLoggerDefaults(jm));
415  // Note - since messageLoggerDefaults is a value_ptr,
416  // there is no concern about deleting here.
417  delete jobMode_p; // dispose of the message text
418  // which will have been new-ed
419  // in MessageLogger.cc (service version)
420  break;
421  }
423  assert( operand == 0 );
424  active = false;
425  break;
426  }
427  case MessageLoggerQ::FLUSH_LOG_Q: { // changelog 26
428  if (singleThread) return;
429  ConfigurationHandshake * h_p =
430  static_cast<ConfigurationHandshake *>(operand);
431  job_pset_p.reset(static_cast<ParameterSet *>(h_p->p));
432  boost::mutex::scoped_lock sl(h_p->m); // get lock
433  h_p->c.notify_all(); // Signal to MessageLoggerQ that we are done
434  // finally, release the scoped lock by letting it go out of scope
435  break;
436  }
437  case MessageLoggerQ::GROUP_STATS: { // change log 27
438  std::string* cat_p =
439  static_cast<std::string*>(operand);
441  delete cat_p; // dispose of the message text
442  break;
443  }
444  case MessageLoggerQ::FJR_SUMMARY: { // changelog 29
445  if (singleThread) {
446  std::map<std::string, double> * smp =
447  static_cast<std::map<std::string, double> *>(operand);
449  break;
450  } else {
451  ConfigurationHandshake * h_p =
452  static_cast<ConfigurationHandshake *>(operand);
453  boost::mutex::scoped_lock sl(h_p->m); // get lock
454  std::map<std::string, double> * smp =
455  static_cast<std::map<std::string, double> *>(h_p->p);
457  h_p->c.notify_all(); // Signal to MessageLoggerQ that we are done
458  // finally, release the scoped lock by letting it go out of scope
459  break;
460  }
461  }
462  } // switch
463 
464 } // MessageLoggerScribe::runCommand(opcode, operand)
virtual char const * what() const
Definition: Exception.cc:141
static unsigned char messageLoggerScribeIsRunning
Definition: MessageDrop.h:109
static MessageDrop * instance()
Definition: MessageDrop.cc:65
boost::shared_ptr< edm::Exception > Pointer_to_new_exception_on_heap
boost::shared_ptr< Pointer_to_new_exception_on_heap > Place_for_passing_exception_ptr
std::vector< NamedDestination * > extern_dests
static void noteGroupedCategory(std::string const &cat)
static edm::JobMode mode(std::string const &jm)
boost::shared_ptr< PSet > job_pset_p
JobMode
Definition: JobMode.h:15
void triggerFJRmessageSummary(std::map< std::string, double > &sm)
value_ptr< MessageLoggerDefaults > messageLoggerDefaults
void edm::service::MessageLoggerScribe::setStaticErrorLog_ptr ( )
inlineprivate

Definition at line 225 of file MessageLoggerScribe.h.

References errorlog_p, and static_errorlog_p.

225 {static_errorlog_p = errorlog_p.get();}
boost::shared_ptr< ErrorLog > errorlog_p
void edm::service::MessageLoggerScribe::triggerFJRmessageSummary ( std::map< std::string, double > &  sm)
private

Definition at line 1229 of file MessageLoggerScribe.cc.

References statisticsDestControls.

Referenced by runCommand().

1230 {
1231  if (statisticsDestControls.empty()) {
1232  sm["NoStatisticsDestinationsConfigured"] = 0.0;
1233  } else {
1234  statisticsDestControls[0].summaryForJobReport(sm);
1235  }
1236 }
std::vector< ELdestControl > statisticsDestControls
void edm::service::MessageLoggerScribe::triggerStatisticsSummaries ( )
private

Definition at line 1219 of file MessageLoggerScribe.cc.

References i, statisticsDestControls, and statisticsResets.

Referenced by runCommand().

1219  {
1220  assert (statisticsDestControls.size() == statisticsResets.size());
1221  for (unsigned int i = 0; i != statisticsDestControls.size(); ++i) {
1222  statisticsDestControls[i].summary( );
1223  if (statisticsResets[i]) statisticsDestControls[i].wipe( );
1224  }
1225 }
int i
Definition: DBlmapReader.cc:9
std::vector< ELdestControl > statisticsDestControls

Member Data Documentation

bool edm::service::MessageLoggerScribe::active
private

Definition at line 243 of file MessageLoggerScribe.h.

Referenced by runCommand().

ELadministrator* edm::service::MessageLoggerScribe::admin_p
private
bool edm::service::MessageLoggerScribe::clean_slate_configuration
private
int edm::service::MessageLoggerScribe::count
private
bool edm::service::MessageLoggerScribe::done
private

Definition at line 245 of file MessageLoggerScribe.h.

Referenced by cfg-viewer.visitor::leave(), run(), and runCommand().

ELdestControl edm::service::MessageLoggerScribe::early_dest
private

Definition at line 229 of file MessageLoggerScribe.h.

Referenced by configure_errorlog(), and configure_ordinary_destinations().

boost::shared_ptr<ErrorLog> edm::service::MessageLoggerScribe::errorlog_p
private

Definition at line 230 of file MessageLoggerScribe.h.

Referenced by setStaticErrorLog_ptr().

std::vector<NamedDestination *> edm::service::MessageLoggerScribe::extern_dests
private
std::vector<boost::shared_ptr<std::ofstream> > edm::service::MessageLoggerScribe::file_ps
private
boost::shared_ptr<PSet> edm::service::MessageLoggerScribe::job_pset_p
private
std::string edm::service::MessageLoggerScribe::jobReportOption
private

Definition at line 239 of file MessageLoggerScribe.h.

Referenced by configure_fwkJobReports(), and runCommand().

boost::shared_ptr<ThreadQueue> edm::service::MessageLoggerScribe::m_queue
private

Definition at line 248 of file MessageLoggerScribe.h.

Referenced by configure_errorlog(), and run().

value_ptr<MessageLoggerDefaults> edm::service::MessageLoggerScribe::messageLoggerDefaults
private
MsgContext edm::service::MessageLoggerScribe::msg_context
private

Definition at line 232 of file MessageLoggerScribe.h.

Referenced by MessageLoggerScribe().

std::vector<String> edm::service::MessageLoggerScribe::ordinary_destination_filenames
private

Definition at line 236 of file MessageLoggerScribe.h.

Referenced by configure_ordinary_destinations(), and configure_statistics().

bool edm::service::MessageLoggerScribe::purge_mode
private

Definition at line 246 of file MessageLoggerScribe.h.

Referenced by runCommand().

bool edm::service::MessageLoggerScribe::singleThread
private

Definition at line 244 of file MessageLoggerScribe.h.

Referenced by configure_errorlog(), and runCommand().

ErrorLog * edm::service::MessageLoggerScribe::static_errorlog_p
staticprivate

Definition at line 240 of file MessageLoggerScribe.h.

Referenced by getErrorLog_ptr(), and setStaticErrorLog_ptr().

std::vector<ELdestControl> edm::service::MessageLoggerScribe::statisticsDestControls
private
std::vector<bool> edm::service::MessageLoggerScribe::statisticsResets
private

Definition at line 238 of file MessageLoggerScribe.h.

Referenced by configure_statistics(), and triggerStatisticsSummaries().

std::map<String,std::ostream *> edm::service::MessageLoggerScribe::stream_ps
private