HDFS-15902. Improve the log for HTTPFS server operation. Contributed by Bhavik Patel.

This commit is contained in:
Takanobu Asanuma 2021-03-24 17:51:35 +09:00
parent ceb75e1e2a
commit b4d97a8dc7
3 changed files with 12 additions and 15 deletions

View File

@ -295,10 +295,8 @@ public HttpURLConnection openConnection(URL url, Token token, String doAs)
// delegation token // delegation token
Credentials creds = UserGroupInformation.getCurrentUser(). Credentials creds = UserGroupInformation.getCurrentUser().
getCredentials(); getCredentials();
if (LOG.isDebugEnabled()) { LOG.debug("Token not set, looking for delegation token. Creds:{},"
LOG.debug("Token not set, looking for delegation token. Creds:{}," + " size:{}", creds.getAllTokens(), creds.numberOfTokens());
+ " size:{}", creds.getAllTokens(), creds.numberOfTokens());
}
if (!creds.getAllTokens().isEmpty()) { if (!creds.getAllTokens().isEmpty()) {
dToken = selectDelegationToken(url, creds); dToken = selectDelegationToken(url, creds);
if (dToken != null) { if (dToken != null) {

View File

@ -285,7 +285,7 @@ public InputStream run() throws Exception {
} }
}); });
} catch (InterruptedException ie) { } catch (InterruptedException ie) {
LOG.info("Open interrupted.", ie); LOG.warn("Open interrupted.", ie);
Thread.currentThread().interrupt(); Thread.currentThread().interrupt();
} }
Long offset = params.get(OffsetParam.NAME, OffsetParam.class); Long offset = params.get(OffsetParam.NAME, OffsetParam.class);
@ -318,7 +318,7 @@ public InputStream run() throws Exception {
enforceRootPath(op.value(), path); enforceRootPath(op.value(), path);
FSOperations.FSHomeDir command = new FSOperations.FSHomeDir(); FSOperations.FSHomeDir command = new FSOperations.FSHomeDir();
JSONObject json = fsExecute(user, command); JSONObject json = fsExecute(user, command);
AUDIT_LOG.info(""); AUDIT_LOG.info("Home Directory for [{}]", user);
response = Response.ok(json).type(MediaType.APPLICATION_JSON).build(); response = Response.ok(json).type(MediaType.APPLICATION_JSON).build();
break; break;
} }
@ -340,7 +340,7 @@ public InputStream run() throws Exception {
FSOperations.FSContentSummary command = FSOperations.FSContentSummary command =
new FSOperations.FSContentSummary(path); new FSOperations.FSContentSummary(path);
Map json = fsExecute(user, command); Map json = fsExecute(user, command);
AUDIT_LOG.info("[{}]", path); AUDIT_LOG.info("Content summary for [{}]", path);
response = Response.ok(json).type(MediaType.APPLICATION_JSON).build(); response = Response.ok(json).type(MediaType.APPLICATION_JSON).build();
break; break;
} }
@ -348,7 +348,7 @@ public InputStream run() throws Exception {
FSOperations.FSQuotaUsage command = FSOperations.FSQuotaUsage command =
new FSOperations.FSQuotaUsage(path); new FSOperations.FSQuotaUsage(path);
Map json = fsExecute(user, command); Map json = fsExecute(user, command);
AUDIT_LOG.info("[{}]", path); AUDIT_LOG.info("Quota Usage for [{}]", path);
response = Response.ok(json).type(MediaType.APPLICATION_JSON).build(); response = Response.ok(json).type(MediaType.APPLICATION_JSON).build();
break; break;
} }
@ -657,14 +657,11 @@ public Response post(InputStream is,
break; break;
} }
case CONCAT: { case CONCAT: {
System.out.println("HTTPFS SERVER CONCAT");
String sources = params.get(SourcesParam.NAME, SourcesParam.class); String sources = params.get(SourcesParam.NAME, SourcesParam.class);
FSOperations.FSConcat command = FSOperations.FSConcat command =
new FSOperations.FSConcat(path, sources.split(",")); new FSOperations.FSConcat(path, sources.split(","));
fsExecute(user, command); fsExecute(user, command);
AUDIT_LOG.info("[{}]", path); AUDIT_LOG.info("[{}]", path);
System.out.println("SENT RESPONSE");
response = Response.ok().build(); response = Response.ok().build();
break; break;
} }

View File

@ -194,9 +194,11 @@ protected void init() throws ServiceException {
throw new ServiceException(FileSystemAccessException.ERROR.H11, ex.toString(), ex); throw new ServiceException(FileSystemAccessException.ERROR.H11, ex.toString(), ex);
} }
LOG.debug("FileSystemAccess FileSystem configuration:"); if (LOG.isDebugEnabled()) {
for (Map.Entry entry : serviceHadoopConf) { LOG.debug("FileSystemAccess FileSystem configuration:");
LOG.debug(" {} = {}", entry.getKey(), entry.getValue()); for (Map.Entry entry : serviceHadoopConf) {
LOG.debug(" {} = {}", entry.getKey(), entry.getValue());
}
} }
setRequiredServiceHadoopConf(serviceHadoopConf); setRequiredServiceHadoopConf(serviceHadoopConf);
@ -262,7 +264,7 @@ public void run() {
LOG.warn("Error while purging filesystem, " + ex.toString(), ex); LOG.warn("Error while purging filesystem, " + ex.toString(), ex);
} }
} }
LOG.debug("Purged [{}} filesystem instances", count); LOG.debug("Purged [{}] filesystem instances", count);
} }
} }