Use MessageSvc to handle ROOT messages
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 beforeApplicationMgr::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, whileMsgStream
instances cache the thresholds; we can optimize the adapter caching internally the thresholds (e.g. with astatic std::unordered_map<std::string, int> thresholds
) or by using a global threshold for ROOT messages.
Merge request reports
Activity
changed milestone to %v36r10
added lhcb-gaudi-head lhcb-head-2 labels
- [2023-01-21 00:03] Validation started with lhcb-gaudi-head#3452
- [2023-01-21 00:23] Validation started with lhcb-run2-gaudi-head#442
- [2023-01-23 00:03] Validation started with lhcb-gaudi-head#3453
Edited by Software for LHCb- Resolved by Marco Clemencic
- Resolved by Marco Clemencic
mentioned in merge request lhcb/LHCb!3938 (closed)
mentioned in merge request lhcb/LHCb!3939 (closed)
- Resolved by Marco Clemencic
added 1 commit
- 2d7f3471 - Restore original ROOT error handler at terminate
- [2023-01-24 00:04] Validation started with lhcb-gaudi-head#3454
- [2023-01-24 00:13] Validation started with lhcb-run2-gaudi-head#443
- [2023-01-25 00:03] Validation started with lhcb-gaudi-head#3455
- [2023-01-25 00:11] Validation started with lhcb-run2-gaudi-head#444
- [2023-01-26 00:04] Validation started with lhcb-gaudi-head#3456
- [2023-01-26 00:16] Validation started with lhcb-run2-gaudi-head#445
Edited by Software for LHCb- Resolved by Marco Clemencic
There is definitely some fallout from this on the ATLAS side. We are now starting to see warning messages from TClass that were previously suppressed. Likely that's related to our use of
gErrorIgnoreLevel
that is now being ignored. But I need to look more closely to be sure.
added 1 commit
- be086a4c - Take into account ROOT message suppression in ROOTErrorHandlerAdapter
About the default setting, the main reason why I started this exercise is that ROOT prints all messages to
stderr
, and in 6.26 we are getting a new Info message that we cannot avoid and it's causing our tests to fail in a way that is a bit tricky to hide. Redirecting the messages tostdout
is a good workaround for us and the easiest way was to override the ROOT error handler.I'd like to keep the default to go to MessageSvc, but we can discuss.
mentioned in merge request atlas/athena!60061 (merged)
mentioned in commit 0069c7e8
mentioned in merge request atlas/athena!60753 (merged)