CMS MessageLogger Service: Routing Messges to log4cplus

import FWCore.ParameterSet.Config as cms
process.load("FWCore.MessageLogger.MessageLogger_cfi")
process.MessageLogger = cms.Service("MLlog4cplus")
process.MessageLogger = cms.Service("MessageLogger",
    destinations = cms.untracked.vstring (
                                      'detailedInfo'                                      
                                    ),
     log4cplus = cms.untracked.PSet(
                      threshold  = cms.untracked.string('ERROR') 
              )
      )
# set the number of events
process.maxEvents = cms.untracked.PSet(
    input = cms.untracked.int32(5)
)
 
process.myAnalysisModule = cms.EDAnalyzer('ModuleThatIssuesMessages')
process.p = cms.Path(process.myAnalysisModule)

)

The service = MLlog4cplus informs the ssytem to attach a destination which will send messages of log4cplus. The PSet log4cplus = {...} configures that destination, just the same as any other output destination could be configured.

Note, however, that the vstring destinations = {...} list must not include "log4cplus". The contents of that vstring are used to decide which ordinary file (or cout or cerr) destinations to create and attach.

Some special information pertaining to using log4cplus as a destination for messages:

  • The four severities of MessageLogger messages correspond to the four directives for issuing to log4cplus. For instance,

    LogWarning("category") leads to a LOG4CPLUS_WARN(...) call.

  • log4cplus dispatches to "appenders". For example, a fileAppender may be established to write the text to a file, or a consoleAppender to write to the job console. It is up to the user code or configuration file to establish which appenders are wanted.
  • In the current implementation, the MLlog4cplus service automatically establishes a fileAppender

Edit | Attach | Watch | Print version | History: r4 < r3 < r2 < r1 | Backlinks | Raw View | WYSIWYG | More topic actions
Topic revision: r4 - 2012-06-12 - NitishDhingra
 
    • Cern Search Icon Cern Search
    • TWiki Search Icon TWiki Search
    • Google Search Icon Google Search

    CMSPublic All webs login

This site is powered by the TWiki collaboration platform Powered by PerlCopyright & 2008-2019 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback