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 (.cfg). Users wishing to customize the behavior of the MessageLogger should read the section on MessageLogger Parameters .
Issuing Messages
In order to issue messages, the module must include the MessageLogger
service header:
#include "FWCore/MessageLogger/interface/MessageLogger.h"
In addition, it is strongly recommended (for consistency with the way all
services are used ) that the .cfg file contain at least the line
service = MessageLogger { }
The braces can enclose specifications of parameters to adjust the
MessageLogger behavior
(see MessageLogger Parameters );
if no parameters are supplied, a sensible CMS default behavior is
provided.
If the .cfg file does not specify the MessageLogger service,
or if a message is issued in code executed before any services are initiated,
then the response to issuing a message will be that the content will
be sent to cerr.
Having included the necessary MessageLogger header, when code wishes to issue
a message, one of these functions can be used:
See CMS Guidelines for Messages and Categories
for advice on which severity
is appropriate, and on choosing category names.
Some other wrinkles about issuing messages:
edm::LogError ("category") << a << b << ... << z;
edm::LogWarning ("category") << a << b << ... << z;
edm::LogInfo ("category") << a << b << ... << z;
When issuing messages:
There is an additional form for issuing a message:
LogDebug ("category") << a << b << ... << z;
This is identical to the others, except:
LogWarning("ReadoutError|TimeBudgetExceeded") << "Processed " << nitems
<< "items and ran out of time";
Compound messges will be reported if any of the individual categories would be reported.
"@SUB=methodName"
(note no spaces).
This will indicate that the message came from that method;
two messages from different "subroutines" are considered, for statistics and
limits purposes, to be two different types of messages even if they are in the same
category and from the same module.
Feature List
Issuing messages
Configuring destinations
Debug messages
#define NDEBUG
will cause compile-time elimination of LogDebug message overhead --
Controlling LogDebug Behavior:
Compile-time Elimination of LogDebug Messages
#define ML_NDEBUG
to cause compile-time elimination of LogDebug message overhead
when NDEBUG
is not defined --
Controlling LogDebug Behavior:
Compile-time Elimination of LogDebug Messages
#define ML_DEBUG
will force LogDebug compilation,
even if NDEBUG
is defined --
Controlling LogDebug Behavior:
Compile-time Elimination of LogDebug Messages
Message Statistics
Framework Job Reports
fwkJobReport
destination can be configured for limits and
thresholds in the same
manner as for other output destinations --
Framework Job Reports ,
MessageLogger Parameters
Mark Fischler
Last modified: November 24, 2005