CMS MessageLogger Service: File Destinations

process TEST = {

  service = MessageLogger {
    untracked vstring destinations = { "detailedInfo"
                                     , "critical"
                                     , "cout"
                                     , "cerr"
                                     }
    untracked PSet critical     = { untracked string threshold = "ERROR"   }
    untracked PSet detailedInfo = { untracked string threshold = "INFO"    } 
    untracked PSet cerr             = { untracked string threshold = "WARNING" }
  }
  path p = { myAnalysisModule }
  module myAnalysisModule = ModuleThatIssuesMessages { }
  source = EmptySource {untracked int32 maxEvents = 5}
}

The strings listed in the vstring files list each represent the name of a file destination (a default extnsion .log is appended). Later, optional further configuration can be supplied for each listed destination. This further configuration typically establishes a threshold and/or limits of how often messages are reacted to, and is written as a PSet with name matching the file name.

There need not be a further configuration PSet for every listed destination. (In this example file, there is no further configuration for the cout destination.) Absent further configuration, the destination will react all messages issued.

Also, observe that the orders in which file names are listed and PSet's are provided are arbitrary and need not match.

Specifying an Explicit Extension

Since the use of the dot character in a PSet name is discouraged, the MessageLogger assigns a default extension .log. The extension used can, however, be specified to be something else, as in:

  service = MessageLogger {
    untracked vstring destinations = { "detailedInfo"
                                     }
    untracked PSet detailedInfo = { untracked string extension = ".txt"    } 
  }

Here, the file produced will be detailedInfo.txt.

Specifying an Explicit File Name

Instead of specifying just the extension, one can specify explicitly the filename to be used (either including the extension or with a default extension of .log), as in:


  service = MessageLogger {
    untracked vstring destinations = { "detailedInfo"
                                     }
    untracked PSet detailedInfo = { untracked string filename = "minutia.out"    } 
  }

This is also a technique you could use to specify that a destination write to a file in a directory other than the working directory, as in:

  service = MessageLogger {
    untracked vstring destinations = { "info"
                                     }
    untracked PSet info = { untracked string filename = "logfiles/minutia.out"    } 
  }

(When doing this, you should, of course, make certain that the specified path will exist. In the example above, if the directory logfile did not exist, the logger would not create one automatically, so the attempt to settup this destination would fail.)

-- SudhirMalik - 30-Aug-2011

Edit | Attach | Watch | Print version | History: r5 | r4 < r3 < r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions...
Topic revision: r1 - 2011-08-30 - SudhirMalik
 
    • 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-2020 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback