CMS MessageLogger: CMS Guidelines for Messages and Categories

CMS MessageLogger Service
CMS Guidelines for Messages and Categories

Messages sent to the logger are identified by two basic dimensions: a severity and a category. There are four fixed severities; the MessageLogger can accept any string (of up to 20 letters) as a category. Here is some guidance for how to decide which severity to use, and which category to assign.

Severity

The severity is embedded in the names of four basic functions, one for each level:
  edm::LogError   ("category") << a << b << ... << z;
  edm::LogWarning ("category") << a << b << ... << z;
  edm::LogInfo    ("category") << a << b << ... << z;
       LogDebug   ("category") << a << b << ... << z;
Here are some guidelines for the use of the functions.
  1. LogDebug: There will be no message formatting overhead if the debugging messages are not enabled, the statement will be able to be removed completely at compile time with the proper defines.
  2. edm::LogDebug:
  3. edm::LogWarning:
  4. edm::LogError: This is only to be used to report errors that result from exceptions throws.

Category

One use of the category is for filtering messages or observing messages types across all algorithms. The category concept matches that of the exception processing, where different actions can be taken based on excception category. When exceptions are caught by the framework, the category of the exception is used as the LogError category. Choosing general names for conditions will facitate filtering and output log browsing.

For errors and warnings, category name examples include:

 
  DataNotFound
  TooLittleData
  TooMuchData
  ReadoutError
  TimeBudgetExceeded
By convention, category names should be 20 characters or shorter.

A log message can be a member of more than one category using the syntax:

  edm::LogWarning("TooLittleData|Tracking") << "...";
Such "compound" categories can, of course, exceed 20 characters.

For Info and Debug, category names can include the function that is being performed. Be aware, however, that the module label will automatically be affixed to the message, so explicitly placing that into the category or as an item in the message is superfluous.

USCMS Software and Computing Home Page - CMS MessageLogger Service Page


Jim Kowalkowski
Last modified: January 5, 2006