Skip to content

Use MessageSvc to handle ROOT messages

Marco Clemencic requested to merge use-messagesvc-for-root-messages into master

The default ROOT error handler (the equivalent of Gaudi MessageSvc) prints messages to stderr, which is problematic with Gaudi based workflows that expect all messages to go through stdout and be filtered according to MessageSvc output level.

This MR replaces the ROOT error handler with an adapter function that redirects to MessageSvc.

There are a couple of drawbacks which the changes proposed here:

  • it works only if ROOT (gROOT) has been initialized before ApplicationMgr::configure, but my tests suggest this is always the case
  • every message sent by ROOT makes a call to IMessageSvc::outputLevel( source ) to decide if the message has to be printed or not, while MsgStream instances cache the thresholds; we can optimize the adapter caching internally the thresholds (e.g. with a static std::unordered_map<std::string, int> thresholds) or by using a global threshold for ROOT messages.

Merge request reports