Skip to content
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

Bad formatting when logging state information #217

Open
DomGarguilo opened this issue Sep 6, 2022 · 0 comments
Open

Bad formatting when logging state information #217

DomGarguilo opened this issue Sep 6, 2022 · 0 comments

Comments

@DomGarguilo
Copy link
Member

When an exception occurs when running rwalk, the state information gets logged.

One of the logs is the lastIndexRow which gets printed like this:

lastIndexRow: class org.apache.hadoop.io.Text - ����-T�g����Uj<�s�S

There is some logic to format various Object types before printing them and I'm thinking a case could be added to this section to format the value of lastIndexRow too:

log.debug("State information");
for (String key : new TreeSet<>(state.getMap().keySet())) {
Object value = state.getMap().get(key);
String logMsg = " " + key + ": ";
if (value == null)
logMsg += "null";
else if (value instanceof String || value instanceof Map || value instanceof Collection
|| value instanceof Number)
logMsg += value;
else if (value instanceof byte[])
logMsg += new String((byte[]) value, UTF_8);
else if (value instanceof PasswordToken)
logMsg += new String(((PasswordToken) value).getPassword(), UTF_8);
else
logMsg += value.getClass() + " - " + value;
log.debug(logMsg);

Maybe something similar to apache/accumulo#2906 could be done here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant