1

I am using a library that throws a reasonable error when called upen and completes the desired action such that my outputs are as expected. However, as other people will use the script, I think the error might be misleading since it's not a problem. I have supressed it using the following command within the script:

exec 2> /dev/null

The problem is that this throws all of the errors to the null directory, thus not printing any other error that might occur.

What I am looking for is a command that can remove errors raised by specific libraries from showing up on the console, allowing others to appear naturally.

  • What libraries, and in what language? – roaima Nov 26 at 8:10
1

What I am looking for is a command that can remove errors raised by specific libraries from showing up on the console, allowing others to appear naturally.

You can pass the logging options to the callee command via a logging configuration document. In there you the caller would be deciding which of the specific libraries' logging lines would be trashed away, and which ones would be dumped to stderr.

To me this is just a common scenario of logging. Most popular Python and Java logging libraries allow this.

  • 2
    Which libraries? Have an example of such a logging configuration document? And, most importantly, what if the program in question doesn't use such a logging library? There doesn't seem to be anything in the question indicating what sort of a program it is. – ilkkachu Aug 29 at 17:01
  • Most system syslog facilities can do such things, too. – Nils Nov 27 at 13:28

Not the answer you're looking for? Browse other questions tagged or ask your own question.