Aggarwal-Raghav commented on code in PR #5884:
URL: https://github.com/apache/hive/pull/5884#discussion_r2167361528
##########
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java:
##########
@@ -262,7 +262,11 @@ public static void main(String[] args) throws Throwable {
startupShutdownMessage(HiveMetaStore.class, args, LOG);
try {
- String msg = "Starting hive metastore on port " + cli.getPort();
+ String msg =
Review Comment:
> why do we need to add this into System.err?
when HMS starts with verbose mode i.e. `bin/hive --service metastore
--verbose`, the verbose info/logs are printed via `System.err`. It was done in
[HIVE-2139](https://issues.apache.org/jira/browse/HIVE-2139). After doing some
research (googling) found this:
`
In Java, System.err is typically used for error messages and verbose output
because it's generally not buffered, unlike System.out, which is often
buffered. This means System.err sends output directly to the console or error
stream, ensuring that error messages are displayed immediately, even if
System.out's buffer is not yet full. This behavior is designed to prioritize
the display of error information, even if it means potentially interrupting or
appearing before the buffered output from System.out.
`
Also, "Starting hive metastore" is printed 3 times (attaching screenshot for
the same)
<img width="1308" alt="Screenshot 2025-06-25 at 11 31 54 PM"
src="https://github.com/user-attachments/assets/e0a727f3-fceb-4d9a-b597-0614323f35d0"
/>
<img width="1508" alt="Screenshot 2025-06-25 at 11 37 17 PM"
src="https://github.com/user-attachments/assets/62f70ae9-2e7a-4717-b7de-b16926080465"
/>
> i think it's better to use logger template "{}"
As its not a LOG line but something like this can be done:
```
String msg =
"Starting hive metastore on port %d. PID is %d"
.formatted(cli.getPort(), ProcessHandle.current().pid());
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]