-
Notifications
You must be signed in to change notification settings - Fork 8.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
YARN-11726: Add logging statements for successful and unsuccessful password retrieval operation #7148
base: trunk
Are you sure you want to change the base?
YARN-11726: Add logging statements for successful and unsuccessful password retrieval operation #7148
Conversation
…ul password retrieval operations
💔 -1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @Hean-Chhinling for the PR!
I hade some minor comments, but the PR looks mostly fine for me.
} | ||
} | ||
catch (IOException ioe) { | ||
password = null; | ||
LOG.error("Unable to retrieve password for alias: {}", alias, ioe); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If i see well here the void error(String var1, Object var2, Object var3);
called, so the 3th throwable wont be logged in this case. Also in this case two error log will be created, so maybe debug level will be also fine here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello @K0K0V0K,
Thank you for your feedbacks. By default SLF4J logging will handle the Throwable as the last parameter for exception logging. Therefore, I do not need another place {} holder for it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried with a DEBUG level log and log message does not appear when I run the unit test that simulate the Exception. I think it better with an ERROR level because now I changed when the password is null it log with WARN level. So when the exception happens, it will log with two log messages in two levels ERROR and WARN.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yup, seems you are right
@@ -509,11 +512,18 @@ static String getPassword(Configuration conf, String alias) { | |||
char[] passchars = conf.getPassword(alias); | |||
if (passchars != null) { | |||
password = new String(passchars); | |||
LOG.info("Successful password retrieval for alias: {}", alias); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think debug level will be enough here, to avoid too much log record.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not so sure, because when I try with DEBUG level and run the unit test the log message is not shown. I think it is override by other log level that is why I used INFO level to see it every time.
Is there a way to see a DEBUG level logs in some cases when the user wants?
Description of PR
This pull request enhances the
getPassword
method in the WebAppUtils class within Hadoop YARN by adding logging for password retrieval operations. Previously, if the password retrieval failed due to a misconfiguration or other issues, it failed silently, providing no indication of the error. This update adds:These changes improve transparency and traceability, making it easier for administrators to identify misconfigurations or other issues in YARN's password management.
How was this patch tested?
The changes were tested using the unit tests for the
getPassword
method, and I added newgetPasswordIOException
for checking the error log when exception happens. These methods performed successfully showing the added logging functionality. No additional integration tests were required since this change only affects logging behavior.For code changes:
LICENSE
,LICENSE-binary
,NOTICE-binary
files?