Changing Message Levels (optional)

Last update: 30 Oct 2018 [History] [Edit]

As said before, an INFO message should convey some amount of actual information to the user. Saying, “hey, I’m here” normally doesn’t qualify for that, so let’s change our messages to the DEBUG level.

In execute, use:

ANA_MSG_DEBUG ("in execute, on entry " << wk()->treeEntry());

In initialize, use:

ANA_MSG_DEBUG ("in initialize");

Now compile and run again. You should see your messages disappear in this run, because DEBUG is below the default level of INFO. In production mode this is quite intended, but for the sake of our tutorial let’s change the message level of our algorithm to make the messages re-appear.

In ATestRun_eljob.cxx, add this line where it says extra algorithm configuration:

alg.setProperty ("OutputLevel", MSG::DEBUG);

and add this include at the beginning:

#include <AsgTools/MsgLevel.h>

If you use a python submission script (ATestRun_eljob.py), just add:

alg.OutputLevel = ROOT.MSG.DEBUG

Then re-run and see your messages re-appear.

tip Note that if you create subtools in your algorithms, they will inherit their parents message level. So when you get to that part of the tutorial you may experience a rather large amount of output, in which case you want to change your default message level back to INFO. Certainly for production level code you’d want to use INFO (or maybe even WARNING) as your default output level.