CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_0/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 }
00483 void MessageLogger::postModule(const ModuleDescription& iDescription)
00484 { unEstablishModule (iDescription, "PostModule"); }
00485 
00486 void
00487 MessageLogger::preModuleEndLumi(const ModuleDescription& desc)
00488 {
00489   establishModule (desc,"@endLumi");                            // ChangeLog 13
00490 }
00491 void MessageLogger::postModuleEndLumi(const ModuleDescription& iDescription)
00492 { unEstablishModule (iDescription, "AfterModEndLumi"); }
00493 
00494 void
00495 MessageLogger::preModuleEndRun(const ModuleDescription& desc)
00496 {
00497   establishModule (desc,"@endRun");                             // ChangeLog 13
00498 }
00499 void MessageLogger::postModuleEndRun(const ModuleDescription& iDescription)
00500 { unEstablishModule (iDescription, "AfterModEndRun"); }
00501 
00502 void
00503 MessageLogger::preModuleEndJob(const ModuleDescription& desc)
00504 {
00505   establishModule (desc,"@endJob");                             // ChangeLog 13
00506 }
00507 void MessageLogger::postModuleEndJob(const ModuleDescription& iDescription)
00508 { unEstablishModule (iDescription, "AfterModEndJob"); }
00509 
00510 //
00511 // callbacks that don't know about the module
00512 //
00513 
00514 void
00515 MessageLogger::postBeginJob()
00516 {
00517   MessageDrop::instance()->runEvent = "BeforeEvents";  
00518   MessageDrop::instance()->setSinglet("AfterBeginJob");     // Change Log 17    
00519 }
00520 
00521 void
00522 MessageLogger::preSource()
00523 {
00524   establish("source");
00525 }
00526 void MessageLogger::postSource()
00527 { unEstablish("AfterSource"); }
00528 
00529 void MessageLogger::preFile()
00530 {  establish("file_open"); }
00531 void MessageLogger::preFileClose()
00532 {  establish("file_close"); }
00533 void MessageLogger::postFile()
00534 { unEstablish("AfterFile"); }
00535 
00536 
00537 void
00538 MessageLogger::preEventProcessing( const edm::EventID& iID
00539                                  , const edm::Timestamp& /*unused*/ )
00540 {
00541   std::ostringstream ost;
00542   curr_event_ = iID;
00543   ost << "Run: " << curr_event_.run() 
00544       << " Event: " << curr_event_.event();                     // change log 2
00545   edm::MessageDrop::instance()->runEvent = ost.str();  
00546   edm::MessageDrop::instance()->setSinglet("PreEventProcessing");// changelog 17
00547   // Note - module name had not been set here  Similarly in other places where
00548   // RunEvent carries the new information; we add setSinglet for module name.
00549 }
00550 
00551 void
00552 MessageLogger::postEventProcessing(const Event&, const EventSetup&)
00553 {
00554   edm::MessageDrop::instance()->runEvent = "PostProcessEvent";  
00555 }
00556 
00557 void
00558 MessageLogger::preBeginRun( const edm::RunID& iID
00559                           , const edm::Timestamp& /*unused*/)   // change log 14
00560 {
00561   std::ostringstream ost;
00562   ost << "Run: " << iID.run();
00563   edm::MessageDrop::instance()->runEvent = ost.str();  
00564   edm::MessageDrop::instance()->setSinglet("PreBeginRun");      // changelog 17
00565 }
00566 void MessageLogger::postBeginRun(const Run&, const EventSetup&)
00567 { 
00568   edm::MessageDrop::instance()->runEvent = "PostBeginRun"; 
00569   edm::MessageDrop::instance()->setSinglet("PostBeginRun");     // changelog 17
00570   // Note - module name had not been set here
00571 }
00572 
00573 void
00574 MessageLogger::prePathBeginRun( const std::string & pathname )  // change log 14
00575 {
00576   edm::MessageDrop::instance()->setPath( "RPath: ", pathname);  // change log 17
00577 }
00578 
00579 void MessageLogger::postPathBeginRun(std::string const&,HLTPathStatus const&)
00580 { 
00581   edm::MessageDrop::instance()->setSinglet("PostPathBeginRun"); // changelog 17
00582 }
00583 
00584 void
00585 MessageLogger::prePathEndRun( const std::string & pathname )    // change log 14
00586 {
00587   edm::MessageDrop::instance()->setPath( "RPathEnd: ", pathname);
00588                                                                 // change log 17
00589 }
00590 
00591 void MessageLogger::postPathEndRun(std::string const&,HLTPathStatus const&)
00592 { 
00593   edm::MessageDrop::instance()->setSinglet("PostPathEndRun");   // changelog 17
00594 }
00595 
00596 void
00597 MessageLogger::prePathBeginLumi( const std::string & pathname ) // change log 14
00598 {
00599   edm::MessageDrop::instance()->setPath( "LPath: ", pathname);  // change log 17
00600 }
00601 
00602 void MessageLogger::postPathBeginLumi(std::string const&,HLTPathStatus const&)
00603 { 
00604   edm::MessageDrop::instance()->setSinglet("PostPathBeginLumi"); // changelog 17
00605 }
00606 
00607 void
00608 MessageLogger::prePathEndLumi( const std::string & pathname )   // change log 14
00609 {
00610   edm::MessageDrop::instance()->setPath( "LPathEnd: ", pathname);
00611                                                                 // change log 17
00612 }
00613 
00614 void MessageLogger::postPathEndLumi(std::string const&,HLTPathStatus const&)
00615 { 
00616   edm::MessageDrop::instance()->setSinglet("PostPathEndLumi"); // changelog 17
00617 }
00618 
00619 void
00620 MessageLogger::preProcessPath( const std::string & pathname )   // change log 14
00621 {
00622   edm::MessageDrop::instance()->setPath( "PreProcPath ", pathname);
00623                                                                 // change log 17
00624 }
00625 
00626 void MessageLogger::postProcessPath(std::string const&,HLTPathStatus const&)
00627 { 
00628   edm::MessageDrop::instance()->setSinglet("PostProcessPath");  // changelog 17
00629 }
00630 
00631 void
00632 MessageLogger::preEndRun( const edm::RunID& iID
00633                         , const edm::Timestamp& /*unused*/)
00634 {
00635   std::ostringstream ost;
00636   ost << "End Run: " << iID.run();
00637   edm::MessageDrop::instance()->runEvent = ost.str();  
00638   edm::MessageDrop::instance()->setSinglet("PreEndRun");        // changelog 17
00639 }
00640 
00641 void MessageLogger::postEndRun(const Run&, const EventSetup&)
00642 { 
00643   edm::MessageDrop::instance()->runEvent = "PostEndRun"; 
00644   edm::MessageDrop::instance()->setSinglet("PostEndRun");       // changelog 17
00645 }
00646 
00647 void
00648 MessageLogger::preBeginLumi( const edm::LuminosityBlockID& iID
00649                           , const edm::Timestamp& /*unused*/)
00650 {
00651   std::ostringstream ost;
00652   ost << "Run: " << iID.run() << " Lumi: " << iID.luminosityBlock();
00653   edm::MessageDrop::instance()->runEvent = ost.str();  
00654   edm::MessageDrop::instance()->setSinglet("PreBeginLumi");     // changelog 17
00655 }
00656 
00657 void MessageLogger::postBeginLumi(const LuminosityBlock&, const EventSetup&)
00658 { 
00659   edm::MessageDrop::instance()->runEvent = "PostBeginLumi"; 
00660   edm::MessageDrop::instance()->setSinglet("PostBeginLumi");    // changelog 17
00661 }
00662 
00663 void
00664 MessageLogger::preEndLumi( const edm::LuminosityBlockID& iID
00665                         , const edm::Timestamp& /*unused*/)
00666 {
00667   std::ostringstream ost;
00668   ost << "Run: " << iID.run() << " Lumi: " << iID.luminosityBlock();
00669   edm::MessageDrop::instance()->runEvent = ost.str();  
00670   edm::MessageDrop::instance()->setSinglet("PreEndLumi");       // changelog 17
00671 }
00672 void MessageLogger::postEndLumi(const LuminosityBlock&, const EventSetup&)
00673 { 
00674   edm::MessageDrop::instance()->runEvent = "PostEndLumi"; 
00675   edm::MessageDrop::instance()->setSinglet("PostEndLumi");      // changelog 17
00676 }
00677 
00678 void
00679 MessageLogger::postEndJob()
00680 {
00681   SummarizeInJobReport();     // Put summary info into Job Rep  // change log 10
00682   MessageLoggerQ::MLqSUM ( ); // trigger summary info.          // change log 9
00683 }
00684 
00685 void
00686 MessageLogger::jobFailure()
00687 {
00688   MessageDrop* messageDrop = MessageDrop::instance();
00689   messageDrop->moduleName = "jobFailure";
00690   SummarizeInJobReport();     // Put summary info into Job Rep  // change log 10
00691   MessageLoggerQ::MLqSUM ( ); // trigger summary info.          // change log 9
00692 }
00693 
00694 
00695 //
00696 // Other methods
00697 //
00698 
00699 void
00700 MessageLogger::SummarizeInJobReport() {
00701   if ( fjrSummaryRequested_ ) { 
00702     std::map<std::string, double> * smp = new std::map<std::string, double> ();
00703     MessageLoggerQ::MLqJRS ( smp );
00704     Service<JobReport> reportSvc;
00705     reportSvc->reportMessageInfo(*smp);
00706     delete smp;
00707   } 
00708 }
00709 
00710 } // end of namespace service  
00711 } // end of namespace edm