Aggarwal-Raghav commented on code in PR #4731: URL: https://github.com/apache/hive/pull/4731#discussion_r1354327832
########## ql/src/java/org/apache/hadoop/hive/ql/session/SessionState.java: ########## @@ -1321,6 +1321,45 @@ public void printInfo(String info, String detail, boolean isSilent) { LOG.info(info + StringUtils.defaultString(detail)); } + /** + * Logs warn into the log file, and if the LogHelper is not silent then into the HiveServer2 or + * HiveCli info stream too. + * BeeLine uses the operation log file to show the logs to the user, so depending on the + * BeeLine settings it could be shown to the user. + * @param warn The log message + */ + public void printWarn(String warn) { + printWarn(warn, null); + } + + /** + * Logs warn into the log file, and if the LogHelper is not silent then into the HiveServer2 or + * HiveCli info stream too. Handles an extra detail which will not be printed if null. + * BeeLine uses the operation log file to show the logs to the user, so depending on the + * BeeLine settings it could be shown to the user. + * @param warn The log message + * @param detail Extra detail to log which will be not printed if null + */ + public void printWarn(String warn, String detail) { + printWarn(warn, detail, getIsSilent()); + } + + /** + * Logs warn into the log file, and if not silent then into the HiveServer2 or HiveCli info + * stream too. Handles an extra detail which will not be printed if null. + * BeeLine uses the operation log file to show the logs to the user, so depending on the + * BeeLine settings it could be shown to the user. + * @param warn The log message + * @param detail Extra detail to log which will be not printed if null + * @param isSilent If true then the message will not be printed to the info stream + */ + public void printWarn(String warn, String detail, boolean isSilent) { + if (!isSilent) { + getInfoStream().println(warn); + } + LOG.warn(warn + org.apache.commons.lang.StringUtils.defaultString(detail)); Review Comment: @pkumarsinha, we can use commons lang3 as it is present in import statement also. Will update the PR and have also verified the changes in local setup. No impact on functionality. ``` 0: jdbc:hive2://localhost:10000> set hive.auto.convert.join=false; WARN : Cannot modify hive.auto.convert.join at runtime. It is in the list of locked configurations that can't be modified at runtime No rows affected (0.014 seconds) hive.log 153:2023-10-11T13:01:23,772 INFO [9c81113d-bf16-4fc7-9515-dd0790dc5f46 HiveServer2-Handler-Pool: Thread-51] session.HiveSessionImpl: executing set hive.auto.convert.join=false 158:2023-10-11T13:01:23,780 WARN [9c81113d-bf16-4fc7-9515-dd0790dc5f46 HiveServer2-Handler-Pool: Thread-51] SessionState: Cannot modify hive.auto.convert.join at runtime. It is in the list of locked configurations that can't be modified at runtime ``` Thanks -- 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: gitbox-unsubscr...@hive.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: gitbox-unsubscr...@hive.apache.org For additional commands, e-mail: gitbox-h...@hive.apache.org