chenchen chenchen - 4 months ago 16
Bash Question

Is there any way to force bash to ignore and hide Cassandra warnings?

basically title, is there any command that can ignore and force bash not to print out the warning(s), similar to

in python? thanks!

edit: the warning is
WARNING: Could not connect to the JMX on localhost:8080, information won't be shown.
, but it does not effect the result of my program so it's not really important.


redirecting error to /dev/null

command-here 2>/dev/null 

(thnx @RandomUser)

redirecting error and output messages to a log file

command-here > myapp.log 2>&1

> file        redirects stdout to file
> /dev/null   redirects stdout to to the null device (discards it)

1> file       redirects stdout to file
2> file       redirects stderr to file
&> file       redirects stdout and stderr to file

/dev/null is the null device it takes any input you want and throws it away.
It can be used to suppress any output.

As @piyushj comment, you can try and change Cassandra log level altogether. Cassandra uses the standard Java log library Log4j

Need to edit the file, and change the line


you can change the logging level to INFO, DEBUG, WARN, ERROR, or FATAL.