CMS MessageLogger: Guide To Issuing Messages


Goal of this page

This page outlines the use of the CMS MessageLogger service.

Introduction and MessageLogger Concepts

The CMS MessageLogger Service is meant to allow code in modules, other services, and other framework "scaffolding" to log messages to a unified message logging and statistics facility.

The MessageLogger Service captures and coordinates messages originating in multiple modules (which, under the CMS framework, will in general be running in multiple threads) into a specified set of destinations. The management of these destinations is based on the ZOOM Error Logger package developed at Fermilab.

All users of the MessageLogger service should read the section on Issuing Messages.

The behavior of the MessageLogger can be adjusted via lines in the job's configuration file ( There is a standardized configuration include file FWCore/MessageLogger/ .

Users wishing to customize the behavior of the MessageLogger should read the section on MessageLogger Parameters.

Configuring the Message Logger

Example Files

Here is a collection of CfgPy files illustrating how to use the configuration language to control how the MessageLogger will behave.

Configuring destinations

Suppression of Messages From Specific Modules

  • Suppressing all LogInfo (or LogDebug or LogWarning) messages from specific modules -- MessageLogger Parameters: Suppressing Information from Specific Modules
  • Enabling LogDebug messages issued by a specific module -- Controlling LogDebug Behavior: Enabling LogDebug Messages

    Debug messages

    Message Statistics

    Framework Job Reports

    Frequently Asked Questions

      The MessageLogger Frequently Asked Questions page addresses the following topics:

    • Dealing with the MessageLogger from non-cmsRun applications
    • Quieting information from specific verbose modules
    • Producing debug information without impacting production running
    • Preventing the SWGuideMessageLogger from tinkering with the message format
    • What if two destinations are configured to write to the same file?

    MessageLogger Behavior

    Descriptions of various aspects of the MessageLoggerBehavior, including:
    • What happens if the configuration specifies two destinations using the same file name?

    CMSSW Guidelines for Messages and Categories

    Messages sent to the logger are identified by two basic dimensions: a severity and a category. The severity is embedded in the names of four basic functions, one for each level. Each also has a partner function which outputs the message contents with absolutely no formatting. Here are some guidelines for the use of the functions. The use of the category will be covered afterwards.

    Guidlines for which severity to use

    The non-formatting function is given in parentheses.

    1. LogDebug (or LogTrace): These are designed as macros, to make inactive LogDebug statements as inexpensive as possible. There will be no message formatting overhead, and the compiler may be able to remove the statement completely at compile-time, if the proper "#defines" are in place to inform the compiler that this is production mode. Also, the configuration can disable LogDebug on a per-module basis.
      • Use this anywhere you what to report state information about your algorithm that is useful for figuring out the behavior of the algorithm or reporting positions that the program has reached. Examples:
        • LogDebug("SegmentFinder") << "Matching segment " << i << " in tracking volume " << vol << "\n";
        • LogDebug("SegmentFinder") << "Starting to find candidates from " << numhits << " hits\n";
      • Use this for messages that would not naturally be included when running on a farm in production.

    2. edm::LogInfo (or edm::LogVerbatim):
      • Use this for low frequency or course-grained status reporting, such as
        • edm::LogInfo("ElectronFinder") << "Saw " << x << " electrons in " << y << " events\n";
      • Messages of this severity will not routinely be included in reports while running on a grid in production.

    3. edm:LogWarning (or edm::LogPrint):
      • Use this when an algorithm encounters a perverse situation which does not cause an exception to be thrown, but which person running the program should be made aware of.
        • edm::LogWarning("Convergence") << "Could not satisfy convergence criteria in " << iters << " iterations, continuing\n";
        • edm::LogWarning("TooManyHits") << "Found too many hits: " << x << ", Pattern recognition skipped in " << reg << "region\n";
      • Caretakers of production jobs run on the grid will see LogWarning messages. Please do not inundate them with messages that express situations which are not intended to eventually be corrected, or with other information which they should not be concerned about.

    4. edm::LogError (or edm::LogProblem): This is used by the framework to report errors that result from exception throws.
      • Do not use edm::LogError this if you throw an exception - the system will make this call for you when the exception is caught. Put all the information that you want reported into the exception. For more information about error handling see:
      • If you do have a situation where you encounter an error, but cannot throw an exception (i.e. can only return a bad return code), then you can report this via edm::LogError.

    Issuing Messages

    FAQ and User-requested Example Configurations

    Message Logger SandBox

    Area in free format for items that the groups wish to add: meetings, to do lists, links etc

    Review Status

    Reviewer/Editor and Date (copy from screen) Comments
    Main.fischler - 25 Jul 2006 page author, latest modification (Mark Fischler)
    JennyWilliams - 31 Jan 2007 modified html code to improve rendering in CMS twiki
    Main.fischler - 31 Jan 2008 Guidelines for Messages and Categories brought up to date (Mark Fischler)
    Main.fischler - 9 Apr 2008 Link to GroupLogStatistics feature (Mark Fischler)

    %RESPONSIBLE% Main.fischler
    %REVIEW% Reviewer

    -- MarkFischler - 12-Oct-2009

Edit | Attach | Watch | Print version | History: r3 < r2 < r1 | Backlinks | Raw View | WYSIWYG | More topic actions
Topic revision: r3 - 2010-07-19 - SudhirMalik
    • Cern Search Icon Cern Search
    • TWiki Search Icon TWiki Search
    • Google Search Icon Google Search

    Sandbox All webs login

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