How not to show the INFO messages in beeline?
To silence INFO messages in Beeline and keep your output clean (showing only errors or query results), you have a few options depending on whether you want a temporary fix or a permanent configuration.
1. Using the --silent Flag (Recommended)
The quickest way to hide INFO and connection messages is to use the -s or --silent flag when starting Beeline. This suppresses all log messages and only displays the results of your queries.
beeline -u jdbc:hive2://localhost:10000 --silent=true
2. Setting the Log Level within the Session
If you are already inside a Beeline session, you can change the log level dynamically. Note that this often depends on your specific Hive configuration (Hadoop/Hive 2.x+).
!set silent true
Note: This command hides the metadata (like table headers and "rows affected") as well.
3. Modifying the beeline-log4j2.properties
For a permanent solution that applies every time you run Beeline, you can modify the Log4j configuration file. This is usually located in your Hive conf directory.
-
Locate beeline-log4j2.properties (or
beeline-log4j.properties). -
Find the line defining the root logger level:
rootLogger.level = INFO -
Change it to WARN or ERROR:
rootLogger.level = WARN
4. Passing Hadoop Options
If you want to override the log level from the command line without changing files, you can pass the HADOOP_CLIENT_OPTS environment variable:
export HADOOP_CLIENT_OPTS="$HADOOP_CLIENT_OPTS -Dhive.root.logger=WARN,console"
beeline -u jdbc:hive2://localhost:10000
Summary Table
| Method | Effect | Best For... |
| --silent=true | Hides all non-result text | Quick scripts and clean output |
| !set silent true | Hides headers and logs | Interactive sessions |
| Log4j Config | Persistent logging change | System administrators |
| HADOOP_CLIENT_OPTS | Environment-wide override | Automation/Docker environments |

浙公网安备 33010602011771号