Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2022-01-27 00:42:05

0001 // -*- C++ -*-
0002 //
0003 // Package:     Services
0004 // Class  :     MessageLogger
0005 //
0006 // Implementation:
0007 //     <Notes on implementation>
0008 //
0009 // Original Author:  W. Brown, M. Fischler
0010 //         Created:  Fri Nov 11 16:42:39 CST 2005
0011 //
0012 
0013 // system include files
0014 // user include files
0015 
0016 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0017 
0018 #include "MessageLogger.h"
0019 #include "MessageServicePSetValidation.h"
0020 
0021 #include "FWCore/MessageLogger/interface/MessageLoggerQ.h"
0022 #include "FWCore/MessageLogger/interface/MessageDrop.h"
0023 
0024 #include "DataFormats/Provenance/interface/ModuleDescription.h"
0025 
0026 #include "FWCore/Framework/interface/ComponentDescription.h"
0027 #include "FWCore/MessageLogger/interface/JobReport.h"
0028 #include "FWCore/Utilities/interface/EDMException.h"
0029 #include "FWCore/ServiceRegistry/interface/Service.h"
0030 #include "FWCore/ServiceRegistry/interface/ActivityRegistry.h"
0031 #include "FWCore/ServiceRegistry/interface/SystemBounds.h"
0032 #include "FWCore/ServiceRegistry/interface/StreamContext.h"
0033 #include "FWCore/ServiceRegistry/interface/ModuleCallingContext.h"
0034 #include "FWCore/ServiceRegistry/interface/ESModuleCallingContext.h"
0035 #include "FWCore/ServiceRegistry/interface/GlobalContext.h"
0036 #include "FWCore/ServiceRegistry/interface/PathContext.h"
0037 
0038 #include <sstream>
0039 #include <limits>
0040 #include <algorithm>
0041 #include <type_traits>
0042 #include <cstring>
0043 #include <charconv>
0044 #include <cassert>
0045 
0046 using namespace edm;
0047 using namespace edm::service;
0048 using namespace edm::messagelogger;
0049 
0050 namespace {
0051   constexpr std::array<char const*, 12> s_globalTransitionNames = {{"@beginJob",
0052                                                                     "@beginProcessBlock",
0053                                                                     "@accessInputProcessBlock",
0054                                                                     "@beginRun",
0055                                                                     "@beginLumi",
0056                                                                     "@endLumi",
0057                                                                     "@endRun",
0058                                                                     "@endProcessBlock",
0059                                                                     "@endJob",
0060                                                                     "@writeProcessBlock",
0061                                                                     "@writeRun",
0062                                                                     "@writeLumi"}};
0063 
0064   constexpr std::array<char const*, 7> s_streamTransitionNames = {{"@beginStream",
0065                                                                    "@streamBeginRun",
0066                                                                    "@streamBeginLumi",
0067                                                                    "",  //event
0068                                                                    "@streamEndLumi",
0069                                                                    "@streamEndRun",
0070                                                                    "@endStream"}};
0071 
0072   char* fill_buffer(char* p, char*) { return p; }
0073 
0074   template <typename T, typename... U>
0075   char* fill_buffer(char* first, char* last, T value, U... u) {
0076     if constexpr (std::is_arithmetic<T>::value) {
0077       auto v = std::to_chars(first, last, value);
0078       assert(v.ec == std::errc{});
0079       return fill_buffer(v.ptr, last, std::forward<U>(u)...);
0080     } else {
0081       auto l = strlen(value);
0082       assert(first + l < last);
0083       std::copy(value, value + l, first);
0084       return fill_buffer(first + l, last, std::forward<U>(u)...);
0085     }
0086   }
0087 
0088   template <typename... T>
0089   std::string_view fill_buffer(std::array<char, 64>& buffer, T... t) {
0090     auto e = fill_buffer(buffer.begin(), buffer.end(), std::forward<T>(t)...);
0091     assert(e < buffer.end());
0092     *e = 0;
0093     return std::string_view(buffer.begin(), e - buffer.begin());
0094   }
0095 
0096 }  // namespace
0097 
0098 namespace edm {
0099   //Forward declare here
0100   // Only the MessageLogger::postEVent function is allowed to call this function.
0101   // So although the function is defined in MessageSender.cc this is the
0102   //  only place where we want it declared.
0103   void clearLoggedErrorsSummary(unsigned int);
0104   void setMaxLoggedErrorsSummaryIndicies(unsigned int iMax);
0105 
0106   namespace service {
0107 
0108     bool edm::service::MessageLogger::anyDebugEnabled_ = false;
0109     bool edm::service::MessageLogger::everyDebugEnabled_ = false;
0110     bool edm::service::MessageLogger::fjrSummaryRequested_ = false;
0111 
0112     //
0113     // constructors and destructor
0114     //
0115     edm::service::MessageLogger::MessageLogger(ParameterSet const& iPS, ActivityRegistry& iRegistry)
0116         : debugEnabled_(false),
0117           messageServicePSetHasBeenValidated_(false),
0118           messageServicePSetValidatationResults_(),
0119           nonModule_debugEnabled(false),
0120           nonModule_infoEnabled(true),
0121           nonModule_warningEnabled(true),
0122           nonModule_errorEnabled(true)  // change log 20
0123     {
0124       // prepare cfg validation string for later use
0125       MessageServicePSetValidation validator;
0126       messageServicePSetValidatationResults_ = validator(iPS);  // change log 12
0127 
0128       typedef std::vector<std::string> vString;
0129       vString empty_vString;
0130       vString debugModules;
0131       vString suppressDebug;
0132       vString suppressInfo;
0133       vString suppressFwkInfo;
0134       vString suppressWarning;
0135       vString suppressError;  // change log 20
0136 
0137       try {  // change log 13
0138              // decide whether a summary should be placed in job report
0139         fjrSummaryRequested_ = iPS.getUntrackedParameter<bool>("messageSummaryToJobReport", false);
0140 
0141         // grab list of debug-enabled modules
0142         debugModules = iPS.getUntrackedParameter<vString>("debugModules", empty_vString);
0143 
0144         // grab lists of suppressLEVEL modules
0145         suppressDebug = iPS.getUntrackedParameter<vString>("suppressDebug", empty_vString);
0146 
0147         suppressInfo = iPS.getUntrackedParameter<vString>("suppressInfo", empty_vString);
0148 
0149         suppressFwkInfo = iPS.getUntrackedParameter<vString>("suppressFwkInfo", empty_vString);
0150 
0151         suppressWarning = iPS.getUntrackedParameter<vString>("suppressWarning", empty_vString);
0152 
0153         suppressError =  // change log 20
0154             iPS.getUntrackedParameter<vString>("suppressError", empty_vString);
0155       } catch (cms::Exception& e) {  // change log 13
0156       }
0157 
0158       // Use these lists to prepare a map to use in tracking suppression
0159 
0160       // Do suppressDebug first and suppressError last to get proper order
0161       for (vString::const_iterator it = suppressDebug.begin(); it != suppressDebug.end(); ++it) {
0162         suppression_levels_[*it] = ELseverityLevel::ELsev_success;
0163       }
0164 
0165       for (vString::const_iterator it = suppressInfo.begin(); it != suppressInfo.end(); ++it) {
0166         suppression_levels_[*it] = ELseverityLevel::ELsev_info;
0167       }
0168 
0169       for (vString::const_iterator it = suppressFwkInfo.begin(); it != suppressFwkInfo.end(); ++it) {
0170         suppression_levels_[*it] = ELseverityLevel::ELsev_fwkInfo;
0171       }
0172 
0173       for (vString::const_iterator it = suppressWarning.begin(); it != suppressWarning.end(); ++it) {
0174         suppression_levels_[*it] = ELseverityLevel::ELsev_warning;
0175       }
0176 
0177       for (vString::const_iterator it = suppressError.begin();  // change log 20
0178            it != suppressError.end();
0179            ++it) {
0180         suppression_levels_[*it] = ELseverityLevel::ELsev_error;
0181       }
0182 
0183       // set up for tracking whether current module is debug-enabled
0184       // (and info-enabled and warning-enabled)
0185       if (debugModules.empty()) {
0186         anyDebugEnabled_ = false;                       // change log 11
0187         MessageDrop::instance()->debugEnabled = false;  // change log 1
0188       } else {
0189         anyDebugEnabled_ = true;  // change log 11
0190         MessageDrop::instance()->debugEnabled = false;
0191         // this will be over-ridden when specific modules are entered
0192       }
0193 
0194       // if ( debugModules.empty()) anyDebugEnabled_ = true; // wrong; change log 11
0195       for (vString::const_iterator it = debugModules.begin(); it != debugModules.end(); ++it) {
0196         if (*it == "*") {
0197           everyDebugEnabled_ = true;
0198         } else {
0199           debugEnabledModules_.insert(*it);
0200         }
0201       }
0202 
0203       // change log 7
0204       std::string jm = edm::MessageDrop::jobMode;
0205       std::string* jm_p = new std::string(jm);
0206       MessageLoggerQ::MLqMOD(jm_p);  // change log 9
0207 
0208       MessageLoggerQ::MLqCFG(new ParameterSet(iPS));  // change log 9
0209 
0210       iRegistry.watchPreallocate([this](edm::service::SystemBounds const& iBounds) {
0211         //reserve the proper amount of space to record the transition info
0212         constexpr unsigned int maxNumberOfConcurrentProcessBlocks = 1;
0213         this->transitionInfoCache_.resize(iBounds.maxNumberOfStreams() +
0214                                           iBounds.maxNumberOfConcurrentLuminosityBlocks() +
0215                                           iBounds.maxNumberOfConcurrentRuns() + maxNumberOfConcurrentProcessBlocks);
0216         lumiInfoBegin_ = iBounds.maxNumberOfStreams();
0217         runInfoBegin_ = lumiInfoBegin_ + iBounds.maxNumberOfConcurrentLuminosityBlocks();
0218         processBlockInfoBegin_ = runInfoBegin_ + iBounds.maxNumberOfConcurrentRuns();
0219 
0220         setMaxLoggedErrorsSummaryIndicies(iBounds.maxNumberOfStreams());
0221       });
0222 
0223       iRegistry.watchPostBeginJob(this, &MessageLogger::postBeginJob);
0224       iRegistry.watchPreEndJob(this, &MessageLogger::preEndJob);
0225       iRegistry.watchPostEndJob(this, &MessageLogger::postEndJob);
0226       iRegistry.watchJobFailure(this, &MessageLogger::jobFailure);  // change log 14
0227 
0228       iRegistry.watchPreModuleConstruction(this, &MessageLogger::preModuleConstruction);
0229       iRegistry.watchPostModuleConstruction(this, &MessageLogger::postModuleConstruction);
0230       // change log 3
0231 
0232       iRegistry.watchPreSourceConstruction(this, &MessageLogger::preSourceConstruction);
0233       iRegistry.watchPostSourceConstruction(this, &MessageLogger::postSourceConstruction);
0234       // change log 3
0235 
0236       iRegistry.watchPreModuleDestruction(this, &MessageLogger::preModuleDestruction);
0237       iRegistry.watchPostModuleDestruction(this, &MessageLogger::postModuleDestruction);
0238 
0239       iRegistry.watchPreModuleEvent(this, &MessageLogger::preModuleEvent);
0240       iRegistry.watchPostModuleEvent(this, &MessageLogger::postModuleEvent);
0241 
0242       iRegistry.watchPreModuleEventAcquire(this, &MessageLogger::preModuleEventAcquire);
0243       iRegistry.watchPostModuleEventAcquire(this, &MessageLogger::postModuleEventAcquire);
0244 
0245       iRegistry.watchPreSourceEvent(this, &MessageLogger::preSourceEvent);
0246       iRegistry.watchPostSourceEvent(this, &MessageLogger::postSourceEvent);
0247       // change log 14:
0248       iRegistry.watchPreSourceRun([this](RunIndex) { preSourceRunLumi(); });
0249       iRegistry.watchPostSourceRun([this](RunIndex) { postSourceRunLumi(); });
0250       iRegistry.watchPreSourceLumi([this](LuminosityBlockIndex) { preSourceRunLumi(); });
0251       iRegistry.watchPostSourceLumi([this](LuminosityBlockIndex) { postSourceRunLumi(); });
0252       iRegistry.watchPreOpenFile(this, &MessageLogger::preFile);
0253       iRegistry.watchPostOpenFile(this, &MessageLogger::postFile);
0254       iRegistry.watchPreCloseFile(this, &MessageLogger::preFileClose);
0255       iRegistry.watchPostCloseFile(this, &MessageLogger::postFile);
0256 
0257       // change log 13:
0258       // change log 15
0259       iRegistry.watchPreModuleBeginJob(this, &MessageLogger::preModuleBeginJob);
0260       iRegistry.watchPostModuleBeginJob(this, &MessageLogger::postModuleBeginJob);
0261       iRegistry.watchPreModuleEndJob(this, &MessageLogger::preModuleEndJob);
0262       iRegistry.watchPostModuleEndJob(this, &MessageLogger::postModuleEndJob);
0263 
0264       iRegistry.watchPreModuleBeginStream(this, &MessageLogger::preModuleBeginStream);
0265       iRegistry.watchPostModuleBeginStream(this, &MessageLogger::postModuleBeginStream);
0266       iRegistry.watchPreModuleEndStream(this, &MessageLogger::preModuleEndStream);
0267       iRegistry.watchPostModuleEndStream(this, &MessageLogger::postModuleEndStream);
0268 
0269       iRegistry.watchPreModuleStreamBeginRun(this, &MessageLogger::preModuleStreamBeginRun);
0270       iRegistry.watchPostModuleStreamBeginRun(this, &MessageLogger::postModuleStreamBeginRun);
0271       iRegistry.watchPreModuleStreamEndRun(this, &MessageLogger::preModuleStreamEndRun);
0272       iRegistry.watchPostModuleStreamEndRun(this, &MessageLogger::postModuleStreamEndRun);
0273       iRegistry.watchPreModuleStreamBeginLumi(this, &MessageLogger::preModuleStreamBeginLumi);
0274       iRegistry.watchPostModuleStreamBeginLumi(this, &MessageLogger::postModuleStreamBeginLumi);
0275       iRegistry.watchPreModuleStreamEndLumi(this, &MessageLogger::preModuleStreamEndLumi);
0276       iRegistry.watchPostModuleStreamEndLumi(this, &MessageLogger::postModuleStreamEndLumi);
0277 
0278       iRegistry.watchPreModuleBeginProcessBlock(this, &MessageLogger::preModuleBeginProcessBlock);
0279       iRegistry.watchPostModuleBeginProcessBlock(this, &MessageLogger::postModuleBeginProcessBlock);
0280       iRegistry.watchPreModuleAccessInputProcessBlock(this, &MessageLogger::preModuleAccessInputProcessBlock);
0281       iRegistry.watchPostModuleAccessInputProcessBlock(this, &MessageLogger::postModuleAccessInputProcessBlock);
0282       iRegistry.watchPreModuleEndProcessBlock(this, &MessageLogger::preModuleEndProcessBlock);
0283       iRegistry.watchPostModuleEndProcessBlock(this, &MessageLogger::postModuleEndProcessBlock);
0284 
0285       iRegistry.watchPreModuleGlobalBeginRun(this, &MessageLogger::preModuleGlobalBeginRun);
0286       iRegistry.watchPostModuleGlobalBeginRun(this, &MessageLogger::postModuleGlobalBeginRun);
0287       iRegistry.watchPreModuleGlobalEndRun(this, &MessageLogger::preModuleGlobalEndRun);
0288       iRegistry.watchPostModuleGlobalEndRun(this, &MessageLogger::postModuleGlobalEndRun);
0289       iRegistry.watchPreModuleWriteRun(this, &MessageLogger::preModuleWriteRun);
0290       iRegistry.watchPostModuleWriteRun(this, &MessageLogger::postModuleWriteRun);
0291       iRegistry.watchPreModuleGlobalBeginLumi(this, &MessageLogger::preModuleGlobalBeginLumi);
0292       iRegistry.watchPostModuleGlobalBeginLumi(this, &MessageLogger::postModuleGlobalBeginLumi);
0293       iRegistry.watchPreModuleGlobalEndLumi(this, &MessageLogger::preModuleGlobalEndLumi);
0294       iRegistry.watchPostModuleGlobalEndLumi(this, &MessageLogger::postModuleGlobalEndLumi);
0295       iRegistry.watchPreModuleWriteLumi(this, &MessageLogger::preModuleWriteLumi);
0296       iRegistry.watchPostModuleWriteLumi(this, &MessageLogger::postModuleWriteLumi);
0297 
0298       iRegistry.watchPreEvent(this, &MessageLogger::preEvent);
0299       iRegistry.watchPostEvent(this, &MessageLogger::postEvent);
0300 
0301       iRegistry.watchPreStreamBeginRun(this, &MessageLogger::preStreamBeginRun);
0302       iRegistry.watchPostStreamBeginRun(this, &MessageLogger::postStreamBeginRun);
0303       iRegistry.watchPreStreamEndRun(this, &MessageLogger::preStreamEndRun);
0304       iRegistry.watchPostStreamEndRun(this, &MessageLogger::postStreamEndRun);
0305       iRegistry.watchPreStreamBeginLumi(this, &MessageLogger::preStreamBeginLumi);
0306       iRegistry.watchPostStreamBeginLumi(this, &MessageLogger::postStreamBeginLumi);
0307       iRegistry.watchPreStreamEndLumi(this, &MessageLogger::preStreamEndLumi);
0308       iRegistry.watchPostStreamEndLumi(this, &MessageLogger::postStreamEndLumi);
0309 
0310       iRegistry.watchPreBeginProcessBlock(this, &MessageLogger::preBeginProcessBlock);
0311       iRegistry.watchPostBeginProcessBlock(this, &MessageLogger::postBeginProcessBlock);
0312       iRegistry.watchPreAccessInputProcessBlock(this, &MessageLogger::preAccessInputProcessBlock);
0313       iRegistry.watchPostAccessInputProcessBlock(this, &MessageLogger::postAccessInputProcessBlock);
0314       iRegistry.watchPreEndProcessBlock(this, &MessageLogger::preEndProcessBlock);
0315       iRegistry.watchPostEndProcessBlock(this, &MessageLogger::postEndProcessBlock);
0316 
0317       iRegistry.watchPreGlobalBeginRun(this, &MessageLogger::preGlobalBeginRun);
0318       iRegistry.watchPostGlobalBeginRun(this, &MessageLogger::postGlobalBeginRun);
0319       iRegistry.watchPreGlobalEndRun(this, &MessageLogger::preGlobalEndRun);
0320       iRegistry.watchPostGlobalEndRun(this, &MessageLogger::postGlobalEndRun);
0321       iRegistry.watchPreGlobalBeginLumi(this, &MessageLogger::preGlobalBeginLumi);
0322       iRegistry.watchPostGlobalBeginLumi(this, &MessageLogger::postGlobalBeginLumi);
0323       iRegistry.watchPreGlobalEndLumi(this, &MessageLogger::preGlobalEndLumi);
0324       iRegistry.watchPostGlobalEndLumi(this, &MessageLogger::postGlobalEndLumi);
0325 
0326       iRegistry.watchPrePathEvent(this, &MessageLogger::prePathEvent);
0327       iRegistry.watchPostPathEvent(this, &MessageLogger::postPathEvent);
0328 
0329       iRegistry.watchPreESModule(this, &MessageLogger::preESModule);
0330       iRegistry.watchPostESModule(this, &MessageLogger::postESModule);
0331 
0332       MessageDrop* messageDrop = MessageDrop::instance();
0333       nonModule_debugEnabled = messageDrop->debugEnabled;
0334       nonModule_infoEnabled = messageDrop->infoEnabled;
0335       nonModule_warningEnabled = messageDrop->warningEnabled;
0336       nonModule_errorEnabled = messageDrop->errorEnabled;
0337     }  // ctor
0338 
0339     void MessageLogger::setThreadContext(ModuleCallingContext const& iModContext) {
0340       //need to know if we are in a global or stream context
0341       auto top = iModContext.getTopModuleCallingContext();
0342       assert(nullptr != top);
0343       if (ParentContext::Type::kGlobal == top->type()) {
0344         auto globalContext = iModContext.getGlobalContext();
0345         auto tran = globalContext->transition();
0346         if (tran == GlobalContext::Transition::kBeginLuminosityBlock or
0347             tran == GlobalContext::Transition::kEndLuminosityBlock) {
0348           establishModule(lumiInfoBegin_ + globalContext->luminosityBlockIndex(),
0349                           iModContext,
0350                           s_globalTransitionNames[static_cast<int>(tran)]);
0351         } else if (tran == GlobalContext::Transition::kBeginRun or tran == GlobalContext::Transition::kEndRun) {
0352           establishModule(
0353               runInfoBegin_ + globalContext->runIndex(), iModContext, s_globalTransitionNames[static_cast<int>(tran)]);
0354         } else if (tran == GlobalContext::Transition::kBeginProcessBlock ||
0355                    tran == GlobalContext::Transition::kAccessInputProcessBlock ||
0356                    tran == GlobalContext::Transition::kEndProcessBlock) {
0357           establishModule(processBlockInfoBegin_, iModContext, s_globalTransitionNames[static_cast<int>(tran)]);
0358         } else {
0359           MessageDrop* messageDrop = MessageDrop::instance();
0360           messageDrop->streamID = std::numeric_limits<unsigned int>::max();
0361           messageDrop->setSinglet("unknown context");
0362           MessageDrop::instance()->runEvent = "";
0363           messageDrop->debugEnabled = nonModule_debugEnabled;
0364           messageDrop->infoEnabled = nonModule_infoEnabled;
0365           messageDrop->warningEnabled = nonModule_warningEnabled;
0366           messageDrop->errorEnabled = nonModule_errorEnabled;
0367         }
0368       } else {
0369         auto stream = iModContext.getStreamContext();
0370         establishModule(
0371             stream->streamID().value(), iModContext, s_streamTransitionNames[static_cast<int>(stream->transition())]);
0372       }
0373     }
0374 
0375     //
0376     // Shared helper routines for establishing module name and enabling behavior
0377     //
0378 
0379     void MessageLogger::establishModule(ModuleDescription const& desc,
0380                                         const char* whichPhase)  // ChangeLog 13, 17
0381     {
0382       MessageDrop* messageDrop = MessageDrop::instance();
0383 
0384       // std::cerr << "establishModule( " << desc.moduleName() << ")\n";
0385       // Change Log 17
0386       messageDrop->setModuleWithPhase(desc.moduleName(), desc.moduleLabel(), desc.id(), whichPhase);
0387       // Removed caching per change 17 - caching is now done in MessageDrop.cc
0388       // in theContext() method, and only happens if a message is actually issued.
0389 
0390       if (!anyDebugEnabled_) {
0391         messageDrop->debugEnabled = false;
0392       } else if (everyDebugEnabled_) {
0393         messageDrop->debugEnabled = true;
0394       } else {
0395         messageDrop->debugEnabled = debugEnabledModules_.count(desc.moduleLabel());
0396       }
0397 
0398       auto it = suppression_levels_.find(desc.moduleLabel());
0399       if (it != suppression_levels_.end()) {
0400         messageDrop->debugEnabled = messageDrop->debugEnabled && (it->second < ELseverityLevel::ELsev_success);
0401         messageDrop->infoEnabled = (it->second < ELseverityLevel::ELsev_info);
0402         messageDrop->fwkInfoEnabled = (it->second < ELseverityLevel::ELsev_fwkInfo);
0403         messageDrop->warningEnabled = (it->second < ELseverityLevel::ELsev_warning);
0404         messageDrop->errorEnabled = (it->second < ELseverityLevel::ELsev_error);
0405       } else {
0406         messageDrop->infoEnabled = true;
0407         messageDrop->fwkInfoEnabled = true;
0408         messageDrop->warningEnabled = true;
0409         messageDrop->errorEnabled = true;
0410       }
0411     }  // establishModule
0412 
0413     void MessageLogger::establishModule(unsigned int transitionIndex,
0414                                         ModuleCallingContext const& mod,
0415                                         const char* whichPhase)  // ChangeLog 13, 17
0416     {
0417       MessageDrop* messageDrop = MessageDrop::instance();
0418 
0419       // std::cerr << "establishModule( " << desc.moduleName() << ")\n";
0420       // Change Log 17
0421       auto const desc = mod.moduleDescription();
0422       messageDrop->runEvent = transitionInfoCache_[transitionIndex].begin();
0423       messageDrop->setModuleWithPhase(desc->moduleName(), desc->moduleLabel(), desc->id(), whichPhase);
0424       messageDrop->streamID = transitionIndex;
0425       if (transitionIndex >= lumiInfoBegin_) {
0426         messageDrop->streamID = std::numeric_limits<unsigned int>::max();
0427       }
0428       // Removed caching per change 17 - caching is now done in MessageDrop.cc
0429       // in theContext() method, and only happens if a message is actually issued.
0430 
0431       if (!anyDebugEnabled_) {
0432         messageDrop->debugEnabled = false;
0433       } else if (everyDebugEnabled_) {
0434         messageDrop->debugEnabled = true;
0435       } else {
0436         messageDrop->debugEnabled = debugEnabledModules_.count(desc->moduleLabel());
0437       }
0438 
0439       auto it = suppression_levels_.find(desc->moduleLabel());
0440       if (it != suppression_levels_.end()) {
0441         messageDrop->debugEnabled = messageDrop->debugEnabled && (it->second < ELseverityLevel::ELsev_success);
0442         messageDrop->infoEnabled = (it->second < ELseverityLevel::ELsev_info);
0443         messageDrop->fwkInfoEnabled = (it->second < ELseverityLevel::ELsev_fwkInfo);
0444         messageDrop->warningEnabled = (it->second < ELseverityLevel::ELsev_warning);
0445         messageDrop->errorEnabled = (it->second < ELseverityLevel::ELsev_error);
0446       } else {
0447         messageDrop->infoEnabled = true;
0448         messageDrop->fwkInfoEnabled = true;
0449         messageDrop->warningEnabled = true;
0450         messageDrop->errorEnabled = true;
0451       }
0452     }  // establishModule
0453 
0454     void MessageLogger::unEstablishModule(ModuleDescription const& /*unused*/, const char* state) {
0455       // std::cerr << "unestablishModule( " << desc.moduleName() << ") "
0456       //           << "state = " << *state << "\n";
0457 
0458       MessageDrop* messageDrop = MessageDrop::instance();
0459       messageDrop->setSinglet(state);  // Change Log 17
0460       messageDrop->debugEnabled = nonModule_debugEnabled;
0461       messageDrop->infoEnabled = nonModule_infoEnabled;
0462       messageDrop->warningEnabled = nonModule_warningEnabled;
0463       messageDrop->errorEnabled = nonModule_errorEnabled;  // change log 20
0464     }
0465 
0466     void MessageLogger::unEstablishModule(ModuleCallingContext const& mod, const char* state) {
0467       //Need to reset to what was previously being used on this thread
0468       auto previous = mod.previousModuleOnThread();
0469       if (previous) {
0470         //need to know if we are in a global or stream context
0471         auto top = previous->getTopModuleCallingContext();
0472         assert(nullptr != top);
0473         if (ParentContext::Type::kGlobal == top->type()) {
0474           auto globalContext = top->globalContext();
0475           assert(nullptr != globalContext);
0476           auto tran = globalContext->transition();
0477           if (tran == GlobalContext::Transition::kBeginLuminosityBlock or
0478               tran == GlobalContext::Transition::kEndLuminosityBlock) {
0479             establishModule(lumiInfoBegin_ + globalContext->luminosityBlockIndex(),
0480                             *previous,
0481                             s_globalTransitionNames[static_cast<int>(tran)]);
0482           } else if (tran == GlobalContext::Transition::kBeginRun or tran == GlobalContext::Transition::kEndRun) {
0483             establishModule(
0484                 runInfoBegin_ + globalContext->runIndex(), *previous, s_globalTransitionNames[static_cast<int>(tran)]);
0485           } else if (tran == GlobalContext::Transition::kBeginProcessBlock ||
0486                      tran == GlobalContext::Transition::kAccessInputProcessBlock ||
0487                      tran == GlobalContext::Transition::kEndProcessBlock) {
0488             establishModule(processBlockInfoBegin_, *previous, s_globalTransitionNames[static_cast<int>(tran)]);
0489           } else {
0490             MessageDrop* messageDrop = MessageDrop::instance();
0491             messageDrop->streamID = std::numeric_limits<unsigned int>::max();
0492             messageDrop->setSinglet("unknown context");
0493             MessageDrop::instance()->runEvent = "";
0494             messageDrop->debugEnabled = nonModule_debugEnabled;
0495             messageDrop->infoEnabled = nonModule_infoEnabled;
0496             messageDrop->warningEnabled = nonModule_warningEnabled;
0497             messageDrop->errorEnabled = nonModule_errorEnabled;
0498           }
0499         } else {
0500           auto stream = previous->getStreamContext();
0501           establishModule(
0502               stream->streamID().value(), *previous, s_streamTransitionNames[static_cast<int>(stream->transition())]);
0503         }
0504       } else {
0505         MessageDrop* messageDrop = MessageDrop::instance();
0506         messageDrop->streamID = std::numeric_limits<unsigned int>::max();
0507         messageDrop->setSinglet(state);  // Change Log 17
0508         messageDrop->debugEnabled = nonModule_debugEnabled;
0509         messageDrop->infoEnabled = nonModule_infoEnabled;
0510         messageDrop->warningEnabled = nonModule_warningEnabled;
0511         messageDrop->errorEnabled = nonModule_errorEnabled;  // change log 20
0512       }
0513 
0514       // std::cerr << "unestablishModule( " << desc.moduleName() << ") "
0515       //           << "state = " << *state << "\n";
0516     }
0517 
0518     void MessageLogger::establish(const char* state) {
0519       MessageDrop* messageDrop = MessageDrop::instance();
0520       messageDrop->setSinglet(state);  // Change Log 17
0521       if (!anyDebugEnabled_) {
0522         messageDrop->debugEnabled = false;
0523       } else if (everyDebugEnabled_) {
0524         messageDrop->debugEnabled = true;
0525       } else {
0526         messageDrop->debugEnabled = debugEnabledModules_.count(state);  // change log 8
0527       }
0528       std::map<const std::string, ELseverityLevel>::const_iterator it =
0529           suppression_levels_.find(state);  // change log 8
0530       if (it != suppression_levels_.end()) {
0531         messageDrop->debugEnabled = messageDrop->debugEnabled && (it->second < ELseverityLevel::ELsev_success);
0532         messageDrop->infoEnabled = (it->second < ELseverityLevel::ELsev_info);
0533         messageDrop->fwkInfoEnabled = (it->second < ELseverityLevel::ELsev_fwkInfo);
0534         messageDrop->warningEnabled = (it->second < ELseverityLevel::ELsev_warning);
0535         messageDrop->errorEnabled = (it->second < ELseverityLevel::ELsev_error);
0536       } else {
0537         messageDrop->infoEnabled = true;
0538         messageDrop->fwkInfoEnabled = true;
0539         messageDrop->warningEnabled = true;
0540         messageDrop->errorEnabled = true;
0541       }
0542     }
0543 
0544     void MessageLogger::unEstablish(const char* state) {
0545       MessageDrop::instance()->setSinglet(state);  // Change Log 17
0546     }
0547 
0548     //
0549     // callbacks that need to establish the module, and their counterparts
0550     //
0551 
0552     void MessageLogger::preModuleConstruction(const ModuleDescription& desc) {
0553       if (!messageServicePSetHasBeenValidated_) {  // change log 12
0554         if (!messageServicePSetValidatationResults_.empty()) {
0555           throw(edm::Exception(edm::errors::Configuration, messageServicePSetValidatationResults_));
0556         }
0557         messageServicePSetHasBeenValidated_ = true;
0558       }
0559       establishModule(desc, "@ctor");  // ChangeLog 16
0560     }
0561     //it is now guaranteed that this will be called even if the module throws
0562     void MessageLogger::postModuleConstruction(const ModuleDescription& iDescription) {
0563       unEstablishModule(iDescription, "AfterModConstruction");
0564     }
0565 
0566     void MessageLogger::preModuleDestruction(const ModuleDescription& desc) { establishModule(desc, "@dtor"); }
0567     //it is guaranteed that this will be called even if the module throws
0568     void MessageLogger::postModuleDestruction(const ModuleDescription& iDescription) {
0569       unEstablishModule(iDescription, "AfterModDestruction");
0570     }
0571 
0572     void MessageLogger::preModuleBeginJob(const ModuleDescription& desc) {
0573       establishModule(desc, "@beginJob");  // ChangeLog 13
0574     }
0575     void MessageLogger::postModuleBeginJob(const ModuleDescription& iDescription) {
0576       unEstablishModule(iDescription, "AfterModBeginJob");
0577     }
0578 
0579     void MessageLogger::preSourceConstruction(const ModuleDescription& desc) {
0580       if (!messageServicePSetHasBeenValidated_) {  // change log 12
0581         if (!messageServicePSetValidatationResults_.empty()) {
0582           throw(edm::Exception(edm::errors::Configuration, messageServicePSetValidatationResults_));
0583         }
0584         messageServicePSetHasBeenValidated_ = true;
0585       }
0586       establishModule(desc, "@sourceConstruction");  // ChangeLog 16
0587     }
0588     void MessageLogger::postSourceConstruction(const ModuleDescription& iDescription) {
0589       unEstablishModule(iDescription, "AfterSourceConstruction");
0590     }
0591 
0592     void MessageLogger::preModuleBeginStream(StreamContext const& stream, ModuleCallingContext const& mcc) {
0593       ModuleDescription const& desc = *mcc.moduleDescription();
0594       establishModule(desc, "@beginStream");  // ChangeLog 13
0595     }
0596     void MessageLogger::postModuleBeginStream(StreamContext const& stream, ModuleCallingContext const& mcc) {
0597       ModuleDescription const& desc = *mcc.moduleDescription();
0598       unEstablishModule(desc, "AfterModBeginStream");
0599     }
0600 
0601     void MessageLogger::preModuleStreamBeginRun(StreamContext const& stream, ModuleCallingContext const& mod) {
0602       establishModule(stream.streamID().value(),
0603                       mod,
0604                       s_streamTransitionNames[static_cast<int>(StreamContext::Transition::kBeginRun)]);
0605     }
0606     void MessageLogger::postModuleStreamBeginRun(StreamContext const& stream, ModuleCallingContext const& mod) {
0607       unEstablishModule(mod, "AfterModStreamBeginRun");
0608     }
0609 
0610     void MessageLogger::preModuleStreamBeginLumi(StreamContext const& stream, ModuleCallingContext const& mod) {
0611       establishModule(stream.streamID().value(),
0612                       mod,
0613                       s_streamTransitionNames[static_cast<int>(StreamContext::Transition::kBeginLuminosityBlock)]);
0614     }
0615     void MessageLogger::postModuleStreamBeginLumi(StreamContext const& stream, ModuleCallingContext const& mod) {
0616       unEstablishModule(mod, "AfterModStreamBeginLumi");
0617     }
0618 
0619     void MessageLogger::preModuleEvent(StreamContext const& stream, ModuleCallingContext const& mod) {
0620       establishModule(
0621           stream.streamID().value(), mod, s_streamTransitionNames[static_cast<int>(StreamContext::Transition::kEvent)]);
0622     }
0623 
0624     void MessageLogger::postModuleEvent(StreamContext const& stream, ModuleCallingContext const& mod) {
0625       unEstablishModule(mod, "PostModuleEvent");
0626     }
0627 
0628     void MessageLogger::preModuleEventAcquire(StreamContext const& stream, ModuleCallingContext const& mod) {
0629       establishModule(
0630           stream.streamID().value(), mod, s_streamTransitionNames[static_cast<int>(StreamContext::Transition::kEvent)]);
0631     }
0632 
0633     void MessageLogger::postModuleEventAcquire(StreamContext const& stream, ModuleCallingContext const& mod) {
0634       unEstablishModule(mod, "PostModuleEventAcquire");
0635     }
0636 
0637     void MessageLogger::preModuleStreamEndLumi(StreamContext const& stream, ModuleCallingContext const& mod) {
0638       establishModule(stream.streamID().value(),
0639                       mod,
0640                       s_streamTransitionNames[static_cast<int>(StreamContext::Transition::kEndLuminosityBlock)]);
0641     }
0642     void MessageLogger::postModuleStreamEndLumi(StreamContext const& stream, ModuleCallingContext const& mod) {
0643       unEstablishModule(mod, "AfterModStreamEndLumi");
0644     }
0645 
0646     void MessageLogger::preModuleStreamEndRun(StreamContext const& stream, ModuleCallingContext const& mod) {
0647       establishModule(stream.streamID().value(),
0648                       mod,
0649                       s_streamTransitionNames[static_cast<int>(StreamContext::Transition::kEndRun)]);  // ChangeLog 13
0650     }
0651     void MessageLogger::postModuleStreamEndRun(StreamContext const& stream, ModuleCallingContext const& mod) {
0652       unEstablishModule(mod, "AfterModStreamEndRun");
0653     }
0654 
0655     //Global
0656 
0657     void MessageLogger::preModuleBeginProcessBlock(GlobalContext const&, ModuleCallingContext const& mod) {
0658       establishModule(processBlockInfoBegin_,
0659                       mod,
0660                       s_globalTransitionNames[static_cast<int>(GlobalContext::Transition::kBeginProcessBlock)]);
0661     }
0662 
0663     void MessageLogger::postModuleBeginProcessBlock(GlobalContext const&, ModuleCallingContext const& mod) {
0664       unEstablishModule(mod, "AfterModBeginProcessBlock");
0665     }
0666 
0667     void MessageLogger::preModuleAccessInputProcessBlock(GlobalContext const&, ModuleCallingContext const& mod) {
0668       establishModule(processBlockInfoBegin_,
0669                       mod,
0670                       s_globalTransitionNames[static_cast<int>(GlobalContext::Transition::kAccessInputProcessBlock)]);
0671     }
0672 
0673     void MessageLogger::postModuleAccessInputProcessBlock(GlobalContext const&, ModuleCallingContext const& mod) {
0674       unEstablishModule(mod, "AfterModAccessInputProcessBlock");
0675     }
0676 
0677     void MessageLogger::preModuleEndProcessBlock(GlobalContext const&, ModuleCallingContext const& mod) {
0678       establishModule(processBlockInfoBegin_,
0679                       mod,
0680                       s_globalTransitionNames[static_cast<int>(GlobalContext::Transition::kEndProcessBlock)]);
0681     }
0682 
0683     void MessageLogger::postModuleEndProcessBlock(GlobalContext const&, ModuleCallingContext const& mod) {
0684       unEstablishModule(mod, "AfterModEndProcessBlock");
0685     }
0686 
0687     void MessageLogger::preModuleGlobalBeginRun(GlobalContext const& context, ModuleCallingContext const& mod) {
0688       establishModule(runInfoBegin_ + context.runIndex().value(),
0689                       mod,
0690                       s_globalTransitionNames[static_cast<int>(GlobalContext::Transition::kBeginRun)]);
0691     }
0692     void MessageLogger::postModuleGlobalBeginRun(GlobalContext const& context, ModuleCallingContext const& mod) {
0693       unEstablishModule(mod, "AfterModGlobalBeginRun");
0694     }
0695 
0696     void MessageLogger::preModuleGlobalBeginLumi(GlobalContext const& context, ModuleCallingContext const& mod) {
0697       establishModule(lumiInfoBegin_ + context.luminosityBlockIndex().value(),
0698                       mod,
0699                       s_globalTransitionNames[static_cast<int>(GlobalContext::Transition::kBeginLuminosityBlock)]);
0700     }
0701     void MessageLogger::postModuleGlobalBeginLumi(GlobalContext const& stream, ModuleCallingContext const& mod) {
0702       unEstablishModule(mod, "AfterModGlobalBeginLumi");
0703     }
0704 
0705     void MessageLogger::preModuleGlobalEndLumi(GlobalContext const& context, ModuleCallingContext const& mod) {
0706       establishModule(lumiInfoBegin_ + context.luminosityBlockIndex().value(),
0707                       mod,
0708                       s_globalTransitionNames[static_cast<int>(GlobalContext::Transition::kEndLuminosityBlock)]);
0709     }
0710     void MessageLogger::postModuleGlobalEndLumi(GlobalContext const& stream, ModuleCallingContext const& mod) {
0711       unEstablishModule(mod, "AfterModGlobalEndLumi");
0712     }
0713 
0714     void MessageLogger::preModuleWriteLumi(GlobalContext const& context, ModuleCallingContext const& mod) {
0715       establishModule(lumiInfoBegin_ + context.luminosityBlockIndex().value(),
0716                       mod,
0717                       s_globalTransitionNames[static_cast<int>(GlobalContext::Transition::kWriteLuminosityBlock)]);
0718     }
0719     void MessageLogger::postModuleWriteLumi(GlobalContext const& stream, ModuleCallingContext const& mod) {
0720       unEstablishModule(mod, "AfterModWriteLumi");
0721     }
0722 
0723     void MessageLogger::preModuleGlobalEndRun(GlobalContext const& context, ModuleCallingContext const& mod) {
0724       establishModule(runInfoBegin_ + context.runIndex().value(),
0725                       mod,
0726                       s_globalTransitionNames[static_cast<int>(GlobalContext::Transition::kEndRun)]);  // ChangeLog 13
0727     }
0728     void MessageLogger::postModuleGlobalEndRun(GlobalContext const& stream, ModuleCallingContext const& mod) {
0729       unEstablishModule(mod, "AfterModGlobalEndRun");
0730     }
0731 
0732     void MessageLogger::preModuleWriteRun(GlobalContext const& context, ModuleCallingContext const& mod) {
0733       establishModule(runInfoBegin_ + context.runIndex().value(),
0734                       mod,
0735                       s_globalTransitionNames[static_cast<int>(GlobalContext::Transition::kWriteRun)]);
0736     }
0737     void MessageLogger::postModuleWriteRun(GlobalContext const& stream, ModuleCallingContext const& mod) {
0738       unEstablishModule(mod, "AfterModWriteRun");
0739     }
0740 
0741     void MessageLogger::preModuleEndStream(StreamContext const&, ModuleCallingContext const& mcc) {
0742       ModuleDescription const& desc = *mcc.moduleDescription();
0743       establishModule(desc, "@endStream");  // ChangeLog 13
0744     }
0745 
0746     void MessageLogger::postModuleEndStream(StreamContext const&, ModuleCallingContext const& mcc) {
0747       ModuleDescription const& desc = *mcc.moduleDescription();
0748       unEstablishModule(desc, "AfterModEndStream");
0749     }
0750 
0751     void MessageLogger::preModuleEndJob(const ModuleDescription& desc) {
0752       establishModule(desc, "@endJob");  // ChangeLog 13
0753     }
0754     void MessageLogger::postModuleEndJob(const ModuleDescription& iDescription) {
0755       unEstablishModule(iDescription, "AfterModEndJob");
0756     }
0757 
0758     void MessageLogger::preESModule(eventsetup::EventSetupRecordKey const&, ESModuleCallingContext const& context) {
0759       MessageDrop* messageDrop = MessageDrop::instance();
0760       auto desc = context.componentDescription();
0761       // std::cerr << "establishModule( " << desc.moduleName() << ")\n";
0762       // Change Log 17
0763       auto label = &desc->label_;
0764       if (label->empty() or (*label)[0] == '\0') {
0765         label = &desc->type_;
0766       }
0767       messageDrop->setModuleWithPhase(desc->type_, *label, desc->id_, "@callESModule");
0768     }
0769     void MessageLogger::postESModule(eventsetup::EventSetupRecordKey const&, ESModuleCallingContext const&) {
0770       MessageDrop* messageDrop = MessageDrop::instance();
0771       messageDrop->setSinglet("@finishedCallESModule");  // Change Log 17
0772     }
0773     //
0774     // callbacks that don't know about the module
0775     //
0776 
0777     void MessageLogger::postBeginJob() {
0778       MessageDrop::instance()->runEvent = "BeforeEvents";
0779       MessageDrop::instance()->setSinglet("AfterBeginJob");  // Change Log 17
0780     }
0781 
0782     void MessageLogger::preSourceEvent(StreamID) {
0783       establish("source");
0784       MessageDrop::instance()->runEvent = "PreSource";
0785     }
0786     void MessageLogger::postSourceEvent(StreamID) {
0787       unEstablish("AfterSource");
0788       MessageDrop::instance()->runEvent = "AfterSource";
0789     }
0790     void MessageLogger::preSourceRunLumi() { establish("source"); }
0791     void MessageLogger::postSourceRunLumi() { unEstablish("AfterSource"); }
0792 
0793     void MessageLogger::preFile(std::string const&) { establish("file_open"); }
0794     void MessageLogger::preFileClose(std::string const&) { establish("file_close"); }
0795     void MessageLogger::postFile(std::string const&) { unEstablish("AfterFile"); }
0796 
0797     void MessageLogger::preEvent(StreamContext const& iContext) {
0798       assert(iContext.streamID().value() < transitionInfoCache_.size());
0799       auto& buffer = transitionInfoCache_[iContext.streamID().value()];
0800       auto const& id = iContext.eventID();
0801       auto v = fill_buffer(buffer, "Run: ", id.run(), " Event: ", id.event());
0802       edm::MessageDrop::instance()->runEvent = v;
0803       edm::MessageDrop::instance()->setSinglet("PreEventProcessing");  // changelog 17
0804           // Note - module name had not been set here  Similarly in other places where
0805           // RunEvent carries the new information; we add setSinglet for module name.
0806     }
0807 
0808     void MessageLogger::postEvent(StreamContext const& iContext) {
0809       edm::MessageDrop::instance()->runEvent = "PostProcessEvent";
0810       edm::clearLoggedErrorsSummary(iContext.streamID().value());
0811     }
0812 
0813     void MessageLogger::preStreamBeginRun(StreamContext const& iContext)  // change log 14
0814     {
0815       auto& buffer = transitionInfoCache_[iContext.streamID().value()];
0816       auto v = fill_buffer(buffer, "Run: ", iContext.eventID().run(), " Stream: ", iContext.streamID().value());
0817 
0818       edm::MessageDrop::instance()->runEvent = v;
0819       edm::MessageDrop::instance()->setSinglet("PreStreamBeginRun");  // changelog 17
0820     }
0821     void MessageLogger::postStreamBeginRun(StreamContext const&) {
0822       edm::MessageDrop::instance()->runEvent = "PostStreamBeginRun";
0823       edm::MessageDrop::instance()->setSinglet("PostStreamBeginRun");  // changelog 17
0824                                                                        // Note - module name had not been set here
0825     }
0826 
0827     void MessageLogger::preStreamEndRun(StreamContext const& iContext) {
0828       auto& buffer = transitionInfoCache_[iContext.streamID().value()];
0829       auto v = fill_buffer(buffer, "End Run: ", iContext.eventID().run(), " Stream: ", iContext.streamID().value());
0830 
0831       edm::MessageDrop::instance()->runEvent = v;
0832       edm::MessageDrop::instance()->setSinglet("PreStreamEndRun");  // changelog 17
0833     }
0834 
0835     void MessageLogger::postStreamEndRun(StreamContext const&) {
0836       edm::MessageDrop::instance()->runEvent = "PostStreamEndRun";
0837       edm::MessageDrop::instance()->setSinglet("PostStreaEndRun");  // changelog 17
0838     }
0839 
0840     void MessageLogger::preStreamBeginLumi(StreamContext const& iContext) {
0841       auto& buffer = transitionInfoCache_[iContext.streamID().value()];
0842       auto const& id = iContext.eventID();
0843       auto v = fill_buffer(
0844           buffer, "Run: ", id.run(), " Lumi: ", id.luminosityBlock(), " Stream: ", iContext.streamID().value());
0845       edm::MessageDrop::instance()->runEvent = v;
0846       edm::MessageDrop::instance()->setSinglet("PreStreamBeginLumi");  // changelog 17
0847     }
0848 
0849     void MessageLogger::postStreamBeginLumi(StreamContext const&) {
0850       edm::MessageDrop::instance()->runEvent = "PostStreamBeginLumi";
0851       edm::MessageDrop::instance()->setSinglet("PostStreamBeginLumi");  // changelog 17
0852     }
0853 
0854     void MessageLogger::preStreamEndLumi(StreamContext const& iContext) {
0855       auto& buffer = transitionInfoCache_[iContext.streamID().value()];
0856       auto const& id = iContext.eventID();
0857       auto v = fill_buffer(
0858           buffer, "Run: ", id.run(), " Lumi: ", id.luminosityBlock(), " Stream: ", iContext.streamID().value());
0859 
0860       edm::MessageDrop::instance()->runEvent = v;
0861       edm::MessageDrop::instance()->setSinglet("PreStreamEndLumi");  // changelog 17
0862     }
0863     void MessageLogger::postStreamEndLumi(StreamContext const&) {
0864       edm::MessageDrop::instance()->runEvent = "PostStreamEndLumi";
0865       edm::MessageDrop::instance()->setSinglet("PostStreamEndLumi");  // changelog 17
0866     }
0867 
0868     void MessageLogger::preBeginProcessBlock(GlobalContext const& gc) {
0869       auto& buffer = transitionInfoCache_[processBlockInfoBegin_];
0870       auto v = fill_buffer(buffer, "pre-events");
0871       edm::MessageDrop::instance()->runEvent = v;
0872       edm::MessageDrop::instance()->setSinglet("PreBeginProcessBlock");
0873     }
0874 
0875     void MessageLogger::postBeginProcessBlock(GlobalContext const& gc) {
0876       edm::MessageDrop::instance()->runEvent = "PostBeginProcessBlock";
0877       edm::MessageDrop::instance()->setSinglet("PostBeginProcessBlock");
0878     }
0879 
0880     void MessageLogger::preAccessInputProcessBlock(GlobalContext const& gc) {
0881       auto& buffer = transitionInfoCache_[processBlockInfoBegin_];
0882       auto v = fill_buffer(buffer, "pre-events");
0883       edm::MessageDrop::instance()->runEvent = v;
0884       edm::MessageDrop::instance()->setSinglet("PreAccessInputProcessBlock");
0885     }
0886 
0887     void MessageLogger::postAccessInputProcessBlock(GlobalContext const& gc) {
0888       edm::MessageDrop::instance()->runEvent = "PostAccessInputProcessBlock";
0889       edm::MessageDrop::instance()->setSinglet("PostAccessInputProcessBlock");
0890     }
0891 
0892     void MessageLogger::preEndProcessBlock(GlobalContext const& gc) {
0893       auto& buffer = transitionInfoCache_[processBlockInfoBegin_];
0894       auto v = fill_buffer(buffer, "post-events");
0895       edm::MessageDrop::instance()->runEvent = v;
0896       edm::MessageDrop::instance()->setSinglet("PreEndProcessBlock");
0897     }
0898 
0899     void MessageLogger::postEndProcessBlock(GlobalContext const& gc) {
0900       edm::MessageDrop::instance()->runEvent = "PostEndProcessBlock";
0901       edm::MessageDrop::instance()->setSinglet("PostEndProcessBlock");
0902     }
0903 
0904     void MessageLogger::preGlobalBeginRun(GlobalContext const& iContext)  // change log 14
0905     {
0906       auto& buffer = transitionInfoCache_[runInfoBegin_ + iContext.runIndex()];
0907       auto v = fill_buffer(buffer, "Run: ", iContext.luminosityBlockID().run());
0908       edm::MessageDrop::instance()->runEvent = v;
0909       edm::MessageDrop::instance()->setSinglet("PreGlobalBeginRun");  // changelog 17
0910     }
0911     void MessageLogger::postGlobalBeginRun(GlobalContext const&) {
0912       edm::MessageDrop::instance()->runEvent = "PostGlobalBeginRun";
0913       edm::MessageDrop::instance()->setSinglet("PostGlobalBeginRun");  // changelog 17
0914                                                                        // Note - module name had not been set here
0915     }
0916 
0917     void MessageLogger::prePathEvent(StreamContext const& stream, PathContext const& iPath)  // change log 14
0918     {
0919       auto messageDrop = edm::MessageDrop::instance();
0920       messageDrop->runEvent = transitionInfoCache_[stream.streamID().value()].begin();
0921       messageDrop->setPath("PreProcPath ", iPath.pathName());
0922       // change log 17
0923     }
0924 
0925     void MessageLogger::postPathEvent(StreamContext const&, PathContext const&, HLTPathStatus const&) {
0926       edm::MessageDrop::instance()->setSinglet("PostProcessPath");  // changelog 17
0927     }
0928 
0929     void MessageLogger::preGlobalEndRun(GlobalContext const& iContext) {
0930       auto& buffer = transitionInfoCache_[runInfoBegin_ + iContext.runIndex()];
0931       auto v = fill_buffer(buffer, "End Run: ", iContext.luminosityBlockID().run());
0932       edm::MessageDrop::instance()->runEvent = v;
0933       edm::MessageDrop::instance()->setSinglet("PreGlobalEndRun");  // changelog 17
0934     }
0935 
0936     void MessageLogger::postGlobalEndRun(GlobalContext const&) {
0937       edm::MessageDrop::instance()->runEvent = "PostGlobalEndRun";
0938       edm::MessageDrop::instance()->setSinglet("PostGlobalEndRun");  // changelog 17
0939     }
0940 
0941     void MessageLogger::preGlobalBeginLumi(GlobalContext const& iContext) {
0942       auto& buffer = transitionInfoCache_[lumiInfoBegin_ + iContext.luminosityBlockIndex()];
0943       auto const& id = iContext.luminosityBlockID();
0944       auto v = fill_buffer(buffer, "Run: ", id.run(), " Lumi: ", id.luminosityBlock());
0945       edm::MessageDrop::instance()->runEvent = v;
0946       edm::MessageDrop::instance()->setSinglet("PreGlobalBeginLumi");  // changelog 17
0947     }
0948 
0949     void MessageLogger::postGlobalBeginLumi(GlobalContext const&) {
0950       edm::MessageDrop::instance()->runEvent = "PostGlobalBeginLumi";
0951       edm::MessageDrop::instance()->setSinglet("PostGlobalBeginLumi");  // changelog 17
0952     }
0953 
0954     void MessageLogger::preGlobalEndLumi(GlobalContext const& iContext) {
0955       auto& buffer = transitionInfoCache_[lumiInfoBegin_ + iContext.luminosityBlockIndex()];
0956       auto const& id = iContext.luminosityBlockID();
0957       auto v = fill_buffer(buffer, "Run: ", id.run(), " Lumi: ", id.luminosityBlock());
0958       edm::MessageDrop::instance()->runEvent = v;
0959       edm::MessageDrop::instance()->setSinglet("PreGlobalEndLumi");  // changelog 17
0960     }
0961     void MessageLogger::postGlobalEndLumi(GlobalContext const&) {
0962       edm::MessageDrop::instance()->runEvent = "PostGlobalEndLumi";
0963       edm::MessageDrop::instance()->setSinglet("PostGlobalEndLumi");  // changelog 17
0964     }
0965 
0966     void MessageLogger::preEndJob() {
0967       edm::MessageDrop::instance()->runEvent = "EndJob";
0968       edm::MessageDrop::instance()->setSinglet("EndJob");  // changelog
0969     }
0970 
0971     void MessageLogger::postEndJob() {
0972       summarizeInJobReport();    // Put summary info into Job Rep  // change log 10
0973       MessageLoggerQ::MLqSUM();  // trigger summary info.       // change log 9
0974     }
0975 
0976     void MessageLogger::jobFailure() {
0977       MessageDrop* messageDrop = MessageDrop::instance();
0978       messageDrop->setSinglet("jobFailure");
0979       summarizeInJobReport();    // Put summary info into Job Rep  // change log 10
0980       MessageLoggerQ::MLqSUM();  // trigger summary info.       // change log 9
0981     }
0982 
0983     //
0984     // Other methods
0985     //
0986 
0987     void MessageLogger::summarizeInJobReport() {
0988       if (fjrSummaryRequested_) {
0989         std::map<std::string, double>* smp = new std::map<std::string, double>();
0990         MessageLoggerQ::MLqJRS(smp);
0991         Service<JobReport> reportSvc;
0992         reportSvc->reportMessageInfo(*smp);
0993         delete smp;
0994       }
0995     }
0996 
0997   }  // end of namespace service
0998 }  // end of namespace edm