MessageLogger

From Mu2eWiki
Jump to navigation Jump to search

Some crib notes about configuring the message logger.

With the default Mu2e message logger configuration we can add the following at the end of the .fcl file ( must be at outermost scope and must follow the standard configuration of the message service):

services.message.destinations.log.categories.Prompt : { limit : 5 }

This will limit messages that go to the log file and have the category "Prompt" to only 5 messages.


In the above line, the fields "services", "message", "destinations" are all magic words that must be there. I believe that the field "log" refers to one of many possible destinations and it refers to stdout for the job. I don't know if "log" is a magic word defined by the message facility or if it is an arbitrary string to identify the configuration that follows. The field "categories" is also a magic word. The field "Prompt" is the example of the name of a "category". A category is the text string argument of the c'tor of a message logger object:

mf::LogInfo("CategoryName") << "Foo";

If you specify a value of -1 for the limit parameter, then there will be no limit on the number of messages. Another way to specify unlimited is for the parameter to be absent. I think you can do that this way:

services.message.destinations.log.categories.Prompt : { }

Instead of the name of a category you can specify the magic word "default"; the limit will then apply to all categories except those that explicitly override the limit.


If you use art --debug-config to look at the Mu2e standard configuration of the message logger it is (with some hand reformatting):

services.message: {
   destinations: {
      log : {
         threshold : "INFO"
         type : "cout"
         categories : {
            ArtReport: { limit: -1
                         reportEvery: 200
            }
            default: { limit: 10 }
         }

      }
      statistics: { type: "cout" }
   }
}

This says that there is a destination named log, that is mapped to cout and it receives all messages with severity INFO or higher. By default all categories but one have their messages limited to 10. The one category that is unlimited is "ArtReport"; this category is only used for the heartbeat message when events are read in.

There is another destination named statistics and I think that this is for end of run stats. The configuration sends it to cout.


With the above line, the output of art --debug-config becomes:

services.message: {
   destinations: {
      log : {
         threshold : "INFO"
         type : "cout"
         categories : {
            ArtReport: { limit: -1
                         reportEvery: 200
            }
            Prompt:  { limit:  5 }
            default: { limit: 10 }
         }

      }
      statistics: { type: "cout" }
   }
}


If I remove all of the config of the message logger and use art --debug-config I get the following (reformatted by hand):

services.message: {
  destinations: {
    STDOUT: {
      threshold: "INFO"
      type: "cout"
      categories: {
        ArtReport: { limit: 100 }
        default: { limit: -1 }
      }
    }
  }
}

This make me think that the log in the above example was an aribtrary identifier ( and that so is STDOUT in this one). This limits the per event boiler plate to the first 100 events and places no limit on other printout.


I think that the right way to explain this stuff is to build examples like the above, without using any fhicl substituions. Once we have the big picture we can learn how to factorize it.

Armed with the above I think I can understand the CMS Message Logger documentation and the CMS Message Logger tutorial examples .

This url will search the CMS documentation for LogInfo and will pop up many more hits: Search the CMS site for LogInfo .