CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_6_2_5/src/FWCore/MessageService/src/MessageLogger.cc

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 //
00003 // Package:     Services
00004 // Class  :     MessageLogger
00005 //
00006 // Implementation:
00007 //     <Notes on implementation>
00008 //
00009 // Original Author:  W. Brown, M. Fischler
00010 //         Created:  Fri Nov 11 16:42:39 CST 2005
00011 //
00012 // Change log
00013 //
00014 // 1  mf  5/12/06       In ctor, MessageDrop::debugEnabled is set to a
00015 //                      sensible value in case action happens before modules
00016 //                      are entered.  If any modules enable debugs, such
00017 //                      LogDebug messages are not immediately discarded
00018 //                      (though they might be filtered at the server side).
00019 //
00020 // 2  mf  5/27/06       In preEventProcessing, change the syntax for 
00021 //                      runEvent from 1/23 to Run: 1 Event: 23
00022 //
00023 // 3 mf   6/27/06       PreModuleConstruction and PreSourceConstruction get
00024 //                      correct module name
00025 //
00026 // 4 mf   6/27/06       Between events the run/event is previous one
00027 //
00028 // 5  mf  3/30/07       Support for --jobreport option
00029 //
00030 // 6 mf   6/6/07        Remove the catches for forgiveness of tracked
00031 //                      parameters 
00032 //
00033 // 7 mf   6/19/07       Support for --jobreport option
00034 //
00035 // 8 wmtan 6/25/07      Enable suppression for sources, just as for modules
00036 //
00037 // 9 mf   7/25/07       Modify names of the MessageLoggerQ methods, eg MLqLOG
00038 //
00039 //10 mf   6/18/07       Insert into the PostEndJob a possible SummarizeInJobReport
00040 //
00041 //11 mf   3/18/09       Fix wrong-sense test establishing anyDebugEnabled_
00042 //
00043 //12 mf   5/19/09       MessageService PSet Validation
00044 //
00045 //13 mf   5/26/09       Get parameters without throwing since validation 
00046 //                      will point out any problems and throw at that point
00047 //
00048 //14 mf   7/1/09        Establish module name and set up enables/suppresses
00049 //                      for all possible calls supplying module descriptor
00050 //
00051 //14 mf   7/1/09        Establish pseudo-module name and set up 
00052 //                      enables/suppresses for other calls from framework
00053 //15 mf   9/8/09        Clean up erroneous assignments of some callbacks
00054 //                      for specific watch routines (eg PreXYZ called postXYZ)
00055 //
00056 //16 mf   9/8/09        Eliminate caching by descriptor address during ctor
00057 //                      phases (since addresses are not yet permanent then)
00058 //
00059 //17 mf   11/2/10       Move preparation of module out to MessageDrop methods
00060 //   crj                which will only be called if a message is actually 
00061 //                      issued.  Caching of the work is done within MessageDrop
00062 //                      so that case of many messages in a module is still fast.
00063 //
00064 //18 mf   11/2/10       Eliminated curr_module, since it was only being used
00065 //                      as a local variable for preparation of name (never
00066 //                      used to transfer info between functions) and change
00067 //                      17 obviates its need.
00068 //
00069 // 19 mf 11/30/10       Add a messageDrop->snapshot() when establishing
00070 //    crj               module ctors, to cure bug 75836.
00071 //
00072 // 20 fwyzard 7/06/11   Add support fro dropping LogError messages
00073 //                      on a per-module basis (needed at HLT)
00074 
00075 // system include files
00076 // user include files
00077 
00078 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00079 
00080 #include "FWCore/MessageService/interface/MessageLogger.h"
00081 #include "FWCore/MessageService/interface/MessageServicePSetValidation.h"
00082 
00083 #include "FWCore/MessageLogger/interface/MessageLoggerQ.h"
00084 #include "FWCore/MessageLogger/interface/MessageDrop.h"
00085 
00086 #include "DataFormats/Provenance/interface/ModuleDescription.h"
00087 
00088 #include "FWCore/MessageLogger/interface/JobReport.h"
00089 #include "FWCore/Utilities/interface/EDMException.h"
00090 #include "FWCore/ServiceRegistry/interface/Service.h"
00091 
00092 #include <sstream>
00093 
00094 using namespace edm;
00095 using namespace edm::service;
00096 
00097 namespace edm {
00098 namespace service {
00099 
00100 bool edm::service::MessageLogger::anyDebugEnabled_                    = false;
00101 bool edm::service::MessageLogger::everyDebugEnabled_                  = false;
00102 bool edm::service::MessageLogger::fjrSummaryRequested_                = false;
00103   
00104 //
00105 // constructors and destructor
00106 //
00107 edm::service::MessageLogger::
00108 MessageLogger( ParameterSet const & iPS
00109              , ActivityRegistry   & iRegistry
00110                             )
00111         : debugEnabled_(false)
00112         , messageServicePSetHasBeenValidated_(false)
00113         , messageServicePSetValidatationResults_() 
00114         , nonModule_debugEnabled(false)
00115         , nonModule_infoEnabled(true)
00116         , nonModule_warningEnabled(true)
00117         , nonModule_errorEnabled(true)                          // change log 20
00118 {
00119   // prepare cfg validation string for later use
00120   MessageServicePSetValidation validator;
00121   messageServicePSetValidatationResults_ = validator(iPS);      // change log 12
00122   
00123   typedef std::vector<std::string> vString;
00124   vString empty_vString;
00125   vString debugModules;
00126   vString suppressDebug;
00127   vString suppressInfo;
00128   vString suppressWarning;
00129   vString suppressError;                                        // change log 20
00130 
00131   try {                                                         // change log 13
00132     // decide whether a summary should be placed in job report
00133     fjrSummaryRequested_ = 
00134           iPS.getUntrackedParameter<bool>("messageSummaryToJobReport", false);
00135 
00136     // grab list of debug-enabled modules
00137     debugModules = 
00138           iPS.getUntrackedParameter<vString>("debugModules", empty_vString);
00139 
00140     // grab lists of suppressLEVEL modules
00141     suppressDebug = 
00142           iPS.getUntrackedParameter<vString>("suppressDebug", empty_vString);
00143 
00144     suppressInfo = 
00145           iPS.getUntrackedParameter<vString>("suppressInfo", empty_vString);
00146 
00147     suppressWarning = 
00148           iPS.getUntrackedParameter<vString>("suppressWarning", empty_vString);
00149 
00150     suppressError =                                             // change log 20
00151           iPS.getUntrackedParameter<vString>("suppressError", empty_vString);
00152   } catch (cms::Exception& e) {                                 // change log 13
00153   }
00154   
00155   // Use these lists to prepare a map to use in tracking suppression 
00156 
00157   // Do suppressDebug first and suppressError last to get proper order
00158   for( vString::const_iterator it  = suppressDebug.begin();
00159                                it != suppressDebug.end(); ++it ) {
00160     suppression_levels_[*it] = ELseverityLevel::ELsev_success;
00161   }
00162   
00163   for( vString::const_iterator it  = suppressInfo.begin();
00164                                it != suppressInfo.end(); ++it ) {
00165     suppression_levels_[*it] = ELseverityLevel::ELsev_info;
00166   }
00167   
00168   for( vString::const_iterator it  = suppressWarning.begin();
00169                                it != suppressWarning.end(); ++it ) {
00170     suppression_levels_[*it] = ELseverityLevel::ELsev_warning;
00171   }
00172 
00173   for( vString::const_iterator it  = suppressError.begin();     // change log 20
00174                                it != suppressError.end(); ++it ) {
00175     suppression_levels_[*it] = ELseverityLevel::ELsev_error;
00176   }
00177   
00178   // set up for tracking whether current module is debug-enabled 
00179   // (and info-enabled and warning-enabled)
00180   if ( debugModules.empty()) {
00181     anyDebugEnabled_ = false;                                   // change log 11
00182     MessageDrop::debugEnabled = false;          // change log 1
00183   } else {
00184     anyDebugEnabled_ = true;                                    // change log 11
00185     MessageDrop::debugEnabled = false;
00186     // this will be over-ridden when specific modules are entered
00187   }
00188 
00189   // if ( debugModules.empty()) anyDebugEnabled_ = true; // wrong; change log 11
00190   for( vString::const_iterator it  = debugModules.begin();
00191                                it != debugModules.end(); ++it ) {
00192     if (*it == "*") { 
00193         everyDebugEnabled_ = true;
00194       } else {
00195         debugEnabledModules_.insert(*it); 
00196       }
00197   }
00198 
00199                                                                 // change log 5
00200   std::string jr_name = edm::MessageDrop::instance()->jobreport_name; 
00201   if (!jr_name.empty()) {                       
00202     std::string * jr_name_p = new std::string(jr_name);
00203     MessageLoggerQ::MLqJOB( jr_name_p );                        // change log 9
00204   }
00205   
00206                                                                 // change log 7
00207   std::string jm = edm::MessageDrop::instance()->jobMode; 
00208   std::string * jm_p = new std::string(jm);
00209   MessageLoggerQ::MLqMOD( jm_p );                               // change log 9
00210   
00211   MessageLoggerQ::MLqCFG( new ParameterSet(iPS) );              // change log 9
00212 
00213   iRegistry.watchPostBeginJob(this,&MessageLogger::postBeginJob);
00214   iRegistry.watchPostEndJob(this,&MessageLogger::postEndJob);
00215   iRegistry.watchJobFailure(this,&MessageLogger::jobFailure);   // change log 14
00216 
00217   iRegistry.watchPreModuleConstruction(this,&MessageLogger::preModuleConstruction);
00218   iRegistry.watchPostModuleConstruction(this,&MessageLogger::postModuleConstruction);
00219                                                                 // change log 3
00220 
00221   iRegistry.watchPreSourceConstruction(this,&MessageLogger::preSourceConstruction);
00222   iRegistry.watchPostSourceConstruction(this,&MessageLogger::postSourceConstruction);
00223                                                                 // change log 3
00224 
00225   iRegistry.watchPreModule(this,&MessageLogger::preModule);
00226   iRegistry.watchPostModule(this,&MessageLogger::postModule);
00227 
00228   iRegistry.watchPreSource(this,&MessageLogger::preSource);
00229   iRegistry.watchPostSource(this,&MessageLogger::postSource);
00230                                                         // change log 14:
00231   iRegistry.watchPreSourceRun(this,&MessageLogger::preSource);
00232   iRegistry.watchPostSourceRun(this,&MessageLogger::postSource);
00233   iRegistry.watchPreSourceLumi(this,&MessageLogger::preSource);
00234   iRegistry.watchPostSourceLumi(this,&MessageLogger::postSource);
00235   iRegistry.watchPreOpenFile(this,&MessageLogger::preFile);
00236   iRegistry.watchPostOpenFile(this,&MessageLogger::postFile);
00237   iRegistry.watchPreCloseFile(this,&MessageLogger::preFileClose);
00238   iRegistry.watchPostCloseFile(this,&MessageLogger::postFile);
00239   
00240                                                         // change log 13:
00241                                                         // change log 15
00242   iRegistry.watchPreModuleBeginJob(this,&MessageLogger::preModuleBeginJob);
00243   iRegistry.watchPostModuleBeginJob(this,&MessageLogger::postModuleBeginJob);
00244   iRegistry.watchPreModuleEndJob(this,&MessageLogger::preModuleEndJob);
00245   iRegistry.watchPostModuleEndJob(this,&MessageLogger::postModuleEndJob);
00246   iRegistry.watchPreModuleBeginRun(this,&MessageLogger::preModuleBeginRun);
00247   iRegistry.watchPostModuleBeginRun(this,&MessageLogger::postModuleBeginRun);
00248   iRegistry.watchPreModuleEndRun(this,&MessageLogger::preModuleEndRun);
00249   iRegistry.watchPostModuleEndRun(this,&MessageLogger::postModuleEndRun);
00250   iRegistry.watchPreModuleBeginLumi(this,&MessageLogger::preModuleBeginLumi);
00251   iRegistry.watchPostModuleBeginLumi(this,&MessageLogger::postModuleBeginLumi);
00252   iRegistry.watchPreModuleEndLumi(this,&MessageLogger::preModuleEndLumi);
00253   iRegistry.watchPostModuleEndLumi(this,&MessageLogger::postModuleEndLumi);
00254 
00255   iRegistry.watchPreProcessEvent(this,&MessageLogger::preEventProcessing);
00256   iRegistry.watchPostProcessEvent(this,&MessageLogger::postEventProcessing);
00257                                                         // change log 14:
00258   iRegistry.watchPreBeginRun(this,&MessageLogger::preBeginRun);
00259   iRegistry.watchPostBeginRun(this,&MessageLogger::postBeginRun);
00260   iRegistry.watchPreEndRun(this,&MessageLogger::preEndRun); // change log 15
00261   iRegistry.watchPostEndRun(this,&MessageLogger::postEndRun);
00262   iRegistry.watchPreBeginLumi(this,&MessageLogger::preBeginLumi);
00263   iRegistry.watchPostBeginLumi(this,&MessageLogger::postBeginLumi);
00264   iRegistry.watchPreEndLumi(this,&MessageLogger::preEndLumi);
00265   iRegistry.watchPostEndLumi(this,&MessageLogger::postEndLumi);
00266 
00267   iRegistry.watchPrePathBeginRun(this,&MessageLogger::prePathBeginRun);
00268   iRegistry.watchPostPathBeginRun(this,&MessageLogger::postPathBeginRun);
00269   iRegistry.watchPrePathEndRun(this,&MessageLogger::prePathEndRun);
00270   iRegistry.watchPostPathEndRun(this,&MessageLogger::postPathEndRun);
00271   iRegistry.watchPrePathBeginLumi(this,&MessageLogger::prePathBeginLumi);
00272   iRegistry.watchPostPathBeginLumi(this,&MessageLogger::postPathBeginLumi);
00273   iRegistry.watchPrePathEndLumi(this,&MessageLogger::prePathEndLumi);
00274   iRegistry.watchPostPathEndLumi(this,&MessageLogger::postPathEndLumi);
00275   iRegistry.watchPreProcessPath(this,&MessageLogger::preProcessPath);
00276   iRegistry.watchPostProcessPath(this,&MessageLogger::postProcessPath);
00277 
00278 } // ctor
00279 
00280 //
00281 // Shared helper routines for establishing module name and enabling behavior
00282 //
00283 
00284 void
00285 MessageLogger::establishModule(ModuleDescription const & desc, 
00286                                const char * whichPhase) // ChangeLog 13, 17
00287 {
00288   MessageDrop* messageDrop = MessageDrop::instance();
00289   nonModule_debugEnabled   = messageDrop->debugEnabled;
00290   nonModule_infoEnabled    = messageDrop->infoEnabled;
00291   nonModule_warningEnabled = messageDrop->warningEnabled;
00292   nonModule_errorEnabled   = messageDrop->errorEnabled;         // change log 20
00293 
00294   // std::cerr << "establishModule( " << desc.moduleName() << ")\n";
00295   // Change Log 17
00296   messageDrop->setModuleWithPhase( desc.moduleName(), desc.moduleLabel(), 
00297                                 &desc, whichPhase );
00298   // Removed caching per change 17 - caching is now done in MessageDrop.cc
00299   // in theContext() method, and only happens if a message is actually issued.
00300   
00301   if (!anyDebugEnabled_) {
00302     messageDrop->debugEnabled = false;
00303   } else if (everyDebugEnabled_) {
00304     messageDrop->debugEnabled = true;
00305   } else {
00306     messageDrop->debugEnabled = 
00307                         debugEnabledModules_.count(desc.moduleLabel());
00308   }
00309 
00310   std::map<const std::string,ELseverityLevel>::const_iterator it =
00311        suppression_levels_.find(desc.moduleLabel());
00312   if ( it != suppression_levels_.end() ) {
00313     messageDrop->debugEnabled  = messageDrop->debugEnabled 
00314                                            && (it->second < ELseverityLevel::ELsev_success );
00315     messageDrop->infoEnabled    = (it->second < ELseverityLevel::ELsev_info );
00316     messageDrop->warningEnabled = (it->second < ELseverityLevel::ELsev_warning );
00317     messageDrop->errorEnabled   = (it->second < ELseverityLevel::ELsev_error );
00318   } else {
00319     messageDrop->infoEnabled    = true;
00320     messageDrop->warningEnabled = true;
00321     messageDrop->errorEnabled   = true;
00322   }
00323 } // establishModule
00324 
00325 void
00326 MessageLogger::establishModuleCtor(ModuleDescription const & desc, 
00327                                const char* whichPhase)  // ChangeLog 16
00328 {
00329   MessageDrop* messageDrop = MessageDrop::instance();
00330   nonModule_debugEnabled   = messageDrop->debugEnabled;
00331   nonModule_infoEnabled    = messageDrop->infoEnabled;
00332   nonModule_warningEnabled = messageDrop->warningEnabled;
00333   nonModule_errorEnabled   = messageDrop->errorEnabled;         // change log 20
00334 
00335   // std::cerr << "establishModuleCtor( " << desc.moduleName() << ")\n";
00336   // Change Log 17
00337   messageDrop->setModuleWithPhase( desc.moduleName(), desc.moduleLabel(), 
00338                                 0, whichPhase );
00339   // Cannot cache the value to improve performance because addresses are 
00340   // not yet permanent - see change log 16.  So did not provide desc ptr.
00341 
00342   if (!anyDebugEnabled_) {
00343     messageDrop->debugEnabled = false;
00344   } else if (everyDebugEnabled_) {
00345     messageDrop->debugEnabled = true;
00346   } else {
00347     messageDrop->debugEnabled = 
00348                         debugEnabledModules_.count(desc.moduleLabel());
00349   }
00350 
00351   std::map<const std::string,ELseverityLevel>::const_iterator it =
00352        suppression_levels_.find(desc.moduleLabel());
00353   if ( it != suppression_levels_.end() ) {
00354     messageDrop->debugEnabled  = messageDrop->debugEnabled 
00355                                            && (it->second < ELseverityLevel::ELsev_success );
00356     messageDrop->infoEnabled    = (it->second < ELseverityLevel::ELsev_info );
00357     messageDrop->warningEnabled = (it->second < ELseverityLevel::ELsev_warning );
00358     messageDrop->errorEnabled   = (it->second < ELseverityLevel::ELsev_error );
00359   } else {
00360     messageDrop->infoEnabled    = true;
00361     messageDrop->warningEnabled = true;
00362     messageDrop->errorEnabled   = true;
00363   }
00364   messageDrop->snapshot();                              // Change Log 18 
00365 } // establishModuleCtor
00366 
00367 void
00368 MessageLogger::unEstablishModule(ModuleDescription const & /*unused*/, 
00369                                  const char*  state)
00370 {
00371       // std::cerr << "unestablishModule( " << desc.moduleName() << ") "
00372       //           << "state = " << *state << "\n";
00373 
00374   MessageDrop* messageDrop = MessageDrop::instance();
00375   messageDrop->setSinglet( state );                     // Change Log 17        
00376   messageDrop->debugEnabled   = nonModule_debugEnabled;
00377   messageDrop->infoEnabled    = nonModule_infoEnabled;
00378   messageDrop->warningEnabled = nonModule_warningEnabled;
00379   messageDrop->errorEnabled   = nonModule_errorEnabled; // change log 20
00380 }
00381 
00382 void
00383 MessageLogger::establish(const char* state)
00384 {
00385   MessageDrop* messageDrop = MessageDrop::instance();
00386   messageDrop->setSinglet( state );                     // Change Log 17        
00387    if (!anyDebugEnabled_) {
00388     messageDrop->debugEnabled = false;
00389   } else if (everyDebugEnabled_) {
00390     messageDrop->debugEnabled = true;
00391   } else {
00392     messageDrop->debugEnabled = 
00393                 debugEnabledModules_.count(state);      // change log 8
00394   }
00395   std::map<const std::string,ELseverityLevel>::const_iterator it =
00396        suppression_levels_.find(state);         // change log 8
00397   if ( it != suppression_levels_.end() ) {
00398     messageDrop->debugEnabled  = messageDrop->debugEnabled
00399                                            && (it->second < ELseverityLevel::ELsev_success );
00400     messageDrop->infoEnabled    = (it->second < ELseverityLevel::ELsev_info );
00401     messageDrop->warningEnabled = (it->second < ELseverityLevel::ELsev_warning );
00402     messageDrop->errorEnabled   = (it->second < ELseverityLevel::ELsev_error );
00403   } else {
00404     messageDrop->infoEnabled    = true;
00405     messageDrop->warningEnabled = true;
00406     messageDrop->errorEnabled   = true;
00407   }
00408 }
00409 
00410 void
00411 MessageLogger::unEstablish(const char* state)
00412 {
00413   MessageDrop::instance()->setSinglet( state );         // Change Log 17        
00414 }
00415 
00416 //
00417 // callbacks that need to establish the module, and their counterparts
00418 //
00419 
00420 void
00421 MessageLogger::preModuleConstruction(const ModuleDescription& desc)
00422 {
00423   if (!messageServicePSetHasBeenValidated_) {                   // change log 12
00424     if (!messageServicePSetValidatationResults_.empty() ) {
00425       throw ( edm::Exception 
00426                    ( edm::errors::Configuration
00427                    , messageServicePSetValidatationResults_ 
00428                    )                                         );
00429     }
00430     messageServicePSetHasBeenValidated_ = true;
00431   } 
00432   establishModuleCtor (desc,"@ctor");                           // ChangeLog 16
00433 }
00434 void MessageLogger::postModuleConstruction(const ModuleDescription& iDescription)
00435 { unEstablishModule (iDescription, "AfterModConstruction"); }
00436 
00437 void
00438 MessageLogger::preModuleBeginJob(const ModuleDescription& desc)
00439 {
00440   establishModule (desc,"@beginJob");                           // ChangeLog 13
00441 }
00442 void MessageLogger::postModuleBeginJob(const ModuleDescription& iDescription)
00443 { unEstablishModule (iDescription, "AfterModBeginJob"); }
00444 
00445 void
00446 MessageLogger::preSourceConstruction(const ModuleDescription& desc)
00447 {
00448   if (!messageServicePSetHasBeenValidated_) {                   // change log 12
00449     if (!messageServicePSetValidatationResults_.empty() ) {
00450       throw ( edm::Exception 
00451                    ( edm::errors::Configuration
00452                    , messageServicePSetValidatationResults_ 
00453                    )                                         );
00454     }
00455     messageServicePSetHasBeenValidated_ = true;
00456   } 
00457   establishModuleCtor (desc,"@sourceConstruction");             // ChangeLog 16
00458 }
00459 void MessageLogger::postSourceConstruction(const ModuleDescription& iDescription)
00460 { unEstablishModule (iDescription, "AfterSourceConstruction"); }
00461 
00462 void
00463 MessageLogger::preModuleBeginRun(const ModuleDescription& desc)
00464 {
00465   establishModule (desc,"@beginRun");                           // ChangeLog 13
00466 }
00467 void MessageLogger::postModuleBeginRun(const ModuleDescription& iDescription)
00468 { unEstablishModule (iDescription, "AfterModBeginRun"); }
00469 
00470 void
00471 MessageLogger::preModuleBeginLumi(const ModuleDescription& desc)
00472 {
00473   establishModule (desc,"@beginLumi");                          // ChangeLog 13
00474 }
00475 void MessageLogger::postModuleBeginLumi(const ModuleDescription& iDescription)
00476 { unEstablishModule (iDescription, "AfterModBeginLumi"); }
00477 
00478 void
00479 MessageLogger::preModule(const ModuleDescription& desc)
00480 {
00481   establishModule (desc,"");                                    // ChangeLog 13
00482   moduleStack_.emplace_back(&desc);
00483 }
00484 
00485 void MessageLogger::postModule(const ModuleDescription& iDescription)
00486 { 
00487   // The moduleStack_ should never be empty, but lets check to be safe ...
00488   if(moduleStack_.empty()) {
00489     unEstablishModule (iDescription, "PostModule");
00490   } else {
00491     moduleStack_.pop_back();
00492     if(moduleStack_.empty()) {
00493       unEstablishModule (iDescription, "PostModule");
00494     } else {
00495       establishModule(*moduleStack_.back(), "");
00496     }
00497   }
00498 }
00499 
00500 void
00501 MessageLogger::preModuleEndLumi(const ModuleDescription& desc)
00502 {
00503   establishModule (desc,"@endLumi");                            // ChangeLog 13
00504 }
00505 void MessageLogger::postModuleEndLumi(const ModuleDescription& iDescription)
00506 { unEstablishModule (iDescription, "AfterModEndLumi"); }
00507 
00508 void
00509 MessageLogger::preModuleEndRun(const ModuleDescription& desc)
00510 {
00511   establishModule (desc,"@endRun");                             // ChangeLog 13
00512 }
00513 void MessageLogger::postModuleEndRun(const ModuleDescription& iDescription)
00514 { unEstablishModule (iDescription, "AfterModEndRun"); }
00515 
00516 void
00517 MessageLogger::preModuleEndJob(const ModuleDescription& desc)
00518 {
00519   establishModule (desc,"@endJob");                             // ChangeLog 13
00520 }
00521 void MessageLogger::postModuleEndJob(const ModuleDescription& iDescription)
00522 { unEstablishModule (iDescription, "AfterModEndJob"); }
00523 
00524 //
00525 // callbacks that don't know about the module
00526 //
00527 
00528 void
00529 MessageLogger::postBeginJob()
00530 {
00531   MessageDrop::instance()->runEvent = "BeforeEvents";  
00532   MessageDrop::instance()->setSinglet("AfterBeginJob");     // Change Log 17    
00533 }
00534 
00535 void
00536 MessageLogger::preSource()
00537 {
00538   establish("source");
00539 }
00540 void MessageLogger::postSource()
00541 { unEstablish("AfterSource"); }
00542 
00543 void MessageLogger::preFile()
00544 {  establish("file_open"); }
00545 void MessageLogger::preFileClose( std::string const &, bool )
00546 {  establish("file_close"); }
00547 void MessageLogger::postFile()
00548 { unEstablish("AfterFile"); }
00549 
00550 
00551 void
00552 MessageLogger::preEventProcessing( const edm::EventID& iID
00553                                  , const edm::Timestamp& /*unused*/ )
00554 {
00555   std::ostringstream ost;
00556   curr_event_ = iID;
00557   ost << "Run: " << curr_event_.run() 
00558       << " Event: " << curr_event_.event();                     // change log 2
00559   edm::MessageDrop::instance()->runEvent = ost.str();  
00560   edm::MessageDrop::instance()->setSinglet("PreEventProcessing");// changelog 17
00561   // Note - module name had not been set here  Similarly in other places where
00562   // RunEvent carries the new information; we add setSinglet for module name.
00563 }
00564 
00565 void
00566 MessageLogger::postEventProcessing(const Event&, const EventSetup&)
00567 {
00568   edm::MessageDrop::instance()->runEvent = "PostProcessEvent";  
00569 }
00570 
00571 void
00572 MessageLogger::preBeginRun( const edm::RunID& iID
00573                           , const edm::Timestamp& /*unused*/)   // change log 14
00574 {
00575   std::ostringstream ost;
00576   ost << "Run: " << iID.run();
00577   edm::MessageDrop::instance()->runEvent = ost.str();  
00578   edm::MessageDrop::instance()->setSinglet("PreBeginRun");      // changelog 17
00579 }
00580 void MessageLogger::postBeginRun(const Run&, const EventSetup&)
00581 { 
00582   edm::MessageDrop::instance()->runEvent = "PostBeginRun"; 
00583   edm::MessageDrop::instance()->setSinglet("PostBeginRun");     // changelog 17
00584   // Note - module name had not been set here
00585 }
00586 
00587 void
00588 MessageLogger::prePathBeginRun( const std::string & pathname )  // change log 14
00589 {
00590   edm::MessageDrop::instance()->setPath( "RPath: ", pathname);  // change log 17
00591 }
00592 
00593 void MessageLogger::postPathBeginRun(std::string const&,HLTPathStatus const&)
00594 { 
00595   edm::MessageDrop::instance()->setSinglet("PostPathBeginRun"); // changelog 17
00596 }
00597 
00598 void
00599 MessageLogger::prePathEndRun( const std::string & pathname )    // change log 14
00600 {
00601   edm::MessageDrop::instance()->setPath( "RPathEnd: ", pathname);
00602                                                                 // change log 17
00603 }
00604 
00605 void MessageLogger::postPathEndRun(std::string const&,HLTPathStatus const&)
00606 { 
00607   edm::MessageDrop::instance()->setSinglet("PostPathEndRun");   // changelog 17
00608 }
00609 
00610 void
00611 MessageLogger::prePathBeginLumi( const std::string & pathname ) // change log 14
00612 {
00613   edm::MessageDrop::instance()->setPath( "LPath: ", pathname);  // change log 17
00614 }
00615 
00616 void MessageLogger::postPathBeginLumi(std::string const&,HLTPathStatus const&)
00617 { 
00618   edm::MessageDrop::instance()->setSinglet("PostPathBeginLumi"); // changelog 17
00619 }
00620 
00621 void
00622 MessageLogger::prePathEndLumi( const std::string & pathname )   // change log 14
00623 {
00624   edm::MessageDrop::instance()->setPath( "LPathEnd: ", pathname);
00625                                                                 // change log 17
00626 }
00627 
00628 void MessageLogger::postPathEndLumi(std::string const&,HLTPathStatus const&)
00629 { 
00630   edm::MessageDrop::instance()->setSinglet("PostPathEndLumi"); // changelog 17
00631 }
00632 
00633 void
00634 MessageLogger::preProcessPath( const std::string & pathname )   // change log 14
00635 {
00636   edm::MessageDrop::instance()->setPath( "PreProcPath ", pathname);
00637                                                                 // change log 17
00638 }
00639 
00640 void MessageLogger::postProcessPath(std::string const&,HLTPathStatus const&)
00641 { 
00642   edm::MessageDrop::instance()->setSinglet("PostProcessPath");  // changelog 17
00643 }
00644 
00645 void
00646 MessageLogger::preEndRun( const edm::RunID& iID
00647                         , const edm::Timestamp& /*unused*/)
00648 {
00649   std::ostringstream ost;
00650   ost << "End Run: " << iID.run();
00651   edm::MessageDrop::instance()->runEvent = ost.str();  
00652   edm::MessageDrop::instance()->setSinglet("PreEndRun");        // changelog 17
00653 }
00654 
00655 void MessageLogger::postEndRun(const Run&, const EventSetup&)
00656 { 
00657   edm::MessageDrop::instance()->runEvent = "PostEndRun"; 
00658   edm::MessageDrop::instance()->setSinglet("PostEndRun");       // changelog 17
00659 }
00660 
00661 void
00662 MessageLogger::preBeginLumi( const edm::LuminosityBlockID& iID
00663                           , const edm::Timestamp& /*unused*/)
00664 {
00665   std::ostringstream ost;
00666   ost << "Run: " << iID.run() << " Lumi: " << iID.luminosityBlock();
00667   edm::MessageDrop::instance()->runEvent = ost.str();  
00668   edm::MessageDrop::instance()->setSinglet("PreBeginLumi");     // changelog 17
00669 }
00670 
00671 void MessageLogger::postBeginLumi(const LuminosityBlock&, const EventSetup&)
00672 { 
00673   edm::MessageDrop::instance()->runEvent = "PostBeginLumi"; 
00674   edm::MessageDrop::instance()->setSinglet("PostBeginLumi");    // changelog 17
00675 }
00676 
00677 void
00678 MessageLogger::preEndLumi( const edm::LuminosityBlockID& iID
00679                         , const edm::Timestamp& /*unused*/)
00680 {
00681   std::ostringstream ost;
00682   ost << "Run: " << iID.run() << " Lumi: " << iID.luminosityBlock();
00683   edm::MessageDrop::instance()->runEvent = ost.str();  
00684   edm::MessageDrop::instance()->setSinglet("PreEndLumi");       // changelog 17
00685 }
00686 void MessageLogger::postEndLumi(const LuminosityBlock&, const EventSetup&)
00687 { 
00688   edm::MessageDrop::instance()->runEvent = "PostEndLumi"; 
00689   edm::MessageDrop::instance()->setSinglet("PostEndLumi");      // changelog 17
00690 }
00691 
00692 void
00693 MessageLogger::postEndJob()
00694 {
00695   SummarizeInJobReport();     // Put summary info into Job Rep  // change log 10
00696   MessageLoggerQ::MLqSUM ( ); // trigger summary info.          // change log 9
00697 }
00698 
00699 void
00700 MessageLogger::jobFailure()
00701 {
00702   MessageDrop* messageDrop = MessageDrop::instance();
00703   messageDrop->moduleName = "jobFailure";
00704   SummarizeInJobReport();     // Put summary info into Job Rep  // change log 10
00705   MessageLoggerQ::MLqSUM ( ); // trigger summary info.          // change log 9
00706 }
00707 
00708 
00709 //
00710 // Other methods
00711 //
00712 
00713 void
00714 MessageLogger::SummarizeInJobReport() {
00715   if ( fjrSummaryRequested_ ) { 
00716     std::map<std::string, double> * smp = new std::map<std::string, double> ();
00717     MessageLoggerQ::MLqJRS ( smp );
00718     Service<JobReport> reportSvc;
00719     reportSvc->reportMessageInfo(*smp);
00720     delete smp;
00721   } 
00722 }
00723 
00724 } // end of namespace service  
00725 } // end of namespace edm