Project

General

Profile

Customizing MessageFacility Behavior

Pending creation of a more systematic explanation of the
behavior options available for the message facility,
with examples using .fcl files, we here present techniques for
doing a few key changes.

Suppressing Timestamps

By default, any message issued with a message header will include
a time stamp indicating when it was issued. While this is normally
desirable, it is an annoyance for regression test applications
(or any applications run with the intent of comparing outputs to some
nominal correct outputs). The timestamps will of course change with each
run of the application.

These timestamps can easily be suppressed by two lines in the job fcl file.
Here is an example, in the mu2e context. The first lines shown would be part
of the existing fcl file (lines having nothing to do with messageFacility are
not shown):

#include "minimalMessageService.fcl" 
services : {
  message : @local::default_message
# ...
}

This would produce a destination called "log" which would go to cout,
and a statistics output also placed in that same log.
( How would a user find this out?)

To suppress all time stamps potentially generated by the message facility,
add the following line (after the close of the services section):

services.message.destinations.log.noTimeStamps : true
Note two things:
  1. The user will need to know what destinations are being used, so that the proper one (or ones if there are multiple destinations created) can be named on the noTimeStamps line(s).
  2. If an experiment-specific module being used emits a time stamp directly to cout (not through the logging mechanism) then this time stamp will not be affected.