# How to set output verbosity level in ROOT?

**URL:** <https://root-forum.cern.ch/t/how-to-set-output-verbosity-level-in-root/11149>\
**Category:** ROOT\
**Created:** [October 13, 2010, 5:48am UTC](https://root-forum.cern.ch/t/how-to-set-output-verbosity-level-in-root/11149 "2010-10-13T05:48:31Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![jingliu](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/jingliu/32/11192_2.png) [@jingliu](https://root-forum.cern.ch/u/jingliu)\
**Post date:** [October 13, 2010, 5:48am UTC](https://root-forum.cern.ch/t/how-to-set-output-verbosity-level-in-root/11149/1 "2010-10-13T05:48:31Z")

</div>

Dear rooters,

There are several functions in TObject specifying different levels of output:

Info()  
Warning()  
Error()  
SysError()  
Fatal()

Is it possible to set the verbosity level so that ROOT will print messages with higher verbosity? For example, is there something like:

```auto

```

and then Info(), Warning() will be ignored, while Error(), SysError() and Fatal() will be called.

I guess ROOT has this kind of system. Is there any documentation or examples?

Cheers, Jing

---

<div class="post-metadata">

**Author:** ![rdm](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/rdm/32/11082_2.png) [@rdm](https://root-forum.cern.ch/u/rdm)\
**Post date:** [October 13, 2010, 2:26pm UTC](https://root-forum.cern.ch/t/how-to-set-output-verbosity-level-in-root/11149/2 "2010-10-13T14:26:51Z")

</div>

Hi Jing,

you can set the verbosity via a global variable using an rootrc env variable, see $ROOTSYS/etc/system.rootrc:

```auto
# Ignore errors lower than the ignore level. Possible values:
# Print, Info, Warning, Error, Break, SysError and Fatal.
Root.ErrorIgnoreLevel: Print
```

Or directly in the code via:

```auto
gErrorIgnoreLevel = kPrint, kInfo, kWarning, kError, kBreak, kSysError, kFatal;
```

setting it to kPrint will print all messages again.

We’ll add it to the manual (unfortunate omission).

Cheers, Fons.

---

<div class="post-metadata">

**Author:** ![jingliu](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/jingliu/32/11192_2.png) [@jingliu](https://root-forum.cern.ch/u/jingliu)\
**Post date:** [October 14, 2010, 1:21am UTC](https://root-forum.cern.ch/t/how-to-set-output-verbosity-level-in-root/11149/3 "2010-10-14T01:21:07Z")

</div>

Dear Fons,

thank you for pointing out another two levels that I didn’t noticed: kPrint and kBreak. However, how can I use them? The Print() function defined in TObject is quit different from Info(), Fatal(), etc. and I cannot find anything like Break().

Cheers, Jing

---

<div class="post-metadata">

**Author:** ![jingliu](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/jingliu/32/11192_2.png) [@jingliu](https://root-forum.cern.ch/u/jingliu)\
**Post date:** [October 14, 2010, 1:23am UTC](https://root-forum.cern.ch/t/how-to-set-output-verbosity-level-in-root/11149/4 "2010-10-14T01:23:29Z")

</div>

Dear Fons,

when shall I use Error() and when shall I use SysError()?

and will the execution of Fatal() terminate the program?

Cheers, Jing

---

<div class="post-metadata">

**Author:** ![rdm](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/rdm/32/11082_2.png) [@rdm](https://root-forum.cern.ch/u/rdm)\
**Post date:** [October 14, 2010, 8:27am UTC](https://root-forum.cern.ch/t/how-to-set-output-verbosity-level-in-root/11149/5 "2010-10-14T08:27:39Z")

</div>

Hi Jing,

use SysError() for any errors coming from system calls, like fopen(), read(), etc. Use Error() for your own errors and yes, Fatal() will abort the program.

Cheers, Fons.

---

<div class="post-metadata">

**Author:** ![jingliu](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/jingliu/32/11192_2.png) [@jingliu](https://root-forum.cern.ch/u/jingliu)\
**Post date:** [October 15, 2010, 12:54am UTC](https://root-forum.cern.ch/t/how-to-set-output-verbosity-level-in-root/11149/6 "2010-10-15T00:54:49Z")

</div>

Dear Fons,

thanks again.

some other questions:

You point out another two levels that I didn’t noticed: kPrint and kBreak. However, how can I use them? The Print() function defined in TObject is quit different from Info(), Fatal(), etc. and I cannot find anything like Break().

Cheers, Jing

---

<div class="post-metadata">

**Author:** ![rdm](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/rdm/32/11082_2.png) [@rdm](https://root-forum.cern.ch/u/rdm)\
**Post date:** [October 15, 2010, 12:22pm UTC](https://root-forum.cern.ch/t/how-to-set-output-verbosity-level-in-root/11149/7 "2010-10-15T12:22:28Z")

</div>

See $ROOTSYS/inc/TError.h. There is a Break() function which is not accessible from the interpreter which is only used via the ROOT errorhandler. There is no Print() function but a Printf() function which uses the kPrint flag. Using Printf() as opposed to printf() allows you to also silence or easily redirect all “normal” messages.

Cheers, Fons.

---

<div class="post-metadata">

**Author:** ![jingliu](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/jingliu/32/11192_2.png) [@jingliu](https://root-forum.cern.ch/u/jingliu)\
**Post date:** [October 15, 2010, 2:34pm UTC](https://root-forum.cern.ch/t/how-to-set-output-verbosity-level-in-root/11149/8 "2010-10-15T14:34:23Z")

</div>

Dear Fons,

Printf() does not accept location as the others do. I have the following levels in mind:

debug - debug info. Normal users don’t want to see them  
routine - messages showing the progress of the program or tell users to do something  
warning - program can still run, but users have to check something  
error - program can still run, but users cannot get what they want anymore  
fatal - program can not run anymore

and it would be good if the functions can pick up locations automatically so that the programmer can concentrate on the messages.

In ROOT, Info() is similar to routine, Warning() is like warning, Error() is like error, Fatal() is like fatal in my mind. But there is nothing like debug.

My question is how can I realize a system as the one in my mind based on the existing error handling functions in ROOT?

Cheers, Jing

---

<div class="post-metadata">

**Author:** ![rdm](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/rdm/32/11082_2.png) [@rdm](https://root-forum.cern.ch/u/rdm)\
**Post date:** [October 15, 2010, 3:51pm UTC](https://root-forum.cern.ch/t/how-to-set-output-verbosity-level-in-root/11149/9 "2010-10-15T15:51:35Z")

</div>

Hi Jing,

in ROOT we use Info() for debug like:

if (gDebug \> xxx)  
Info(“location”, “x is %d and y is %d”, x, y);

The other messages are used as such.

Cheers, Fons.

---

<div class="post-metadata">

**Author:** ![jingliu](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/jingliu/32/11192_2.png) [@jingliu](https://root-forum.cern.ch/u/jingliu)\
**Post date:** [October 15, 2010, 4:06pm UTC](https://root-forum.cern.ch/t/how-to-set-output-verbosity-level-in-root/11149/10 "2010-10-15T16:06:57Z")

</div>

Dear Fons,

clear, thanks!

Cheers, Jing

---

<div class="post-metadata">

**Author:** ![sumanta](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/s/4da419/32.png) [@sumanta](https://root-forum.cern.ch/u/sumanta)\
**Post date:** [May 28, 2018, 2:23pm UTC](https://root-forum.cern.ch/t/how-to-set-output-verbosity-level-in-root/11149/11 "2018-05-28T14:23:11Z")

</div>

Hi,

Is it possible to choose more than one option out of all verbosity? Say, I want to choose kError and kWarning but not others. If possible, how to write inside the code?

I have tried  
gErrorIgnoreLevel = kError, kWarning;

if I choose only kPrint, I see this error message :  
Error: Symbol kPrint is not defined in current scope

Cheers,  
Sumanta

---

<div class="post-metadata">

**Author:** ![OliverEvans96](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/oliverevans96/32/16353_2.png) [@OliverEvans96](https://root-forum.cern.ch/u/OliverEvans96)\
**Post date:** [May 31, 2018, 1:57pm UTC](https://root-forum.cern.ch/t/how-to-set-output-verbosity-level-in-root/11149/12 "2018-05-31T13:57:03Z")

</div>

@sumanta, did you use `#include "TError.h"`?

---

<div class="post-metadata">

**Author:** ![sumanta](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/s/4da419/32.png) [@sumanta](https://root-forum.cern.ch/u/sumanta)\
**Post date:** [June 1, 2018, 8:29am UTC](https://root-forum.cern.ch/t/how-to-set-output-verbosity-level-in-root/11149/13 "2018-06-01T08:29:12Z")

</div>

Yes, I have used #include “TError.h”.
