-
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
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -47,6 +47,8 @@ | |
import org.apache.hadoop.yarn.webapp.NotFoundException; | ||
import org.apache.http.NameValuePair; | ||
import org.apache.http.client.utils.URLEncodedUtils; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
import javax.servlet.http.HttpServletRequest; | ||
|
||
|
@@ -61,6 +63,7 @@ public class WebAppUtils { | |
"ssl.server.keystore.keypassword"; | ||
public static final String HTTPS_PREFIX = "https://"; | ||
public static final String HTTP_PREFIX = "http://"; | ||
public static final Logger LOG = LoggerFactory.getLogger(WebAppUtils.class); | ||
|
||
public static void setRMWebAppPort(Configuration conf, int port) { | ||
String hostname = getRMWebAppURLWithoutScheme(conf); | ||
|
@@ -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); | ||
} | ||
} | ||
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 commentThe reason will be displayed to describe this comment to others. Learn more. If i see well here the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hello @K0K0V0K, There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 commentThe reason will be displayed to describe this comment to others. Learn more. yup, seems you are right |
||
} | ||
|
||
if (password == null) { | ||
LOG.error("Password does not exist for alias: {}", alias); | ||
Hean-Chhinling marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
|
||
return password; | ||
} | ||
|
||
|
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?