Details
Description
When multiply tasks use one jvm and generated logs.
eg.
./attempt_201211220735_0001_m_000000_0:
log.index
./attempt_201211220735_0001_m_000001_0:
log.index
./attempt_201211220735_0001_m_000002_0:
log.index stderr stdout syslog
get from http://xxxxxxxx:50060/tasklog?attemptid= attempt_201211220735_0001_m_000000_0
could get stderr,stdout,but not the others,include syslog.
see TaskLogServlet.haveTaskLog() method, not check from local && log.index, but check the original path.
resolve:
modify TaskLogServlet haveTaskLog method
private boolean haveTaskLog(TaskAttemptID taskId, boolean isCleanup,
TaskLog.LogName type) throws IOException {
File f = TaskLog.getTaskLogFile(taskId, isCleanup, type);
if (f.exists() && f.canRead())
else {
File indexFile = TaskLog.getIndexFile(taskId, isCleanup);
if (!indexFile.exists())
BufferedReader fis;
try
catch (FileNotFoundException ex) {
LOG.warn("Index file for the log of " + taskId
+ " does not exist.");
// Assume no task reuse is used and files exist on attemptdir
StringBuffer input = new StringBuffer();
input.append(LogFileDetail.LOCATION
+ TaskLog.getAttemptDir(taskId, isCleanup) + "\n");
for (LogName logName : TaskLog.LOGS_TRACKED_BY_INDEX_FILES)
fis = new BufferedReader(new StringReader(input.toString()));
}
try {
String str = fis.readLine();
if (str == null)
String loc = str.substring(str.indexOf(LogFileDetail.LOCATION)
+ LogFileDetail.LOCATION.length());
File tf = new File(loc, type.toString());
return tf.exists() && tf.canRead();
} finally
{ if (fis != null) fis.close(); }
}
}
workaround:
url add filter=SYSLOG could print syslog also.