HDFS-3390. DFSAdmin should print full stack traces of errors when DEBUG logging is enabled. Contributed by Aaron T. Myers.
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1336324 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
c853a425a0
commit
e3fbc52686
@ -435,6 +435,9 @@ Release 2.0.0 - UNRELEASED
|
|||||||
so that INodeFile and INodeFileUnderConstruction do not have to be used in
|
so that INodeFile and INodeFileUnderConstruction do not have to be used in
|
||||||
block management. (John George via szetszwo)
|
block management. (John George via szetszwo)
|
||||||
|
|
||||||
|
HDFS-3390. DFSAdmin should print full stack traces of errors when DEBUG
|
||||||
|
logging is enabled. (atm)
|
||||||
|
|
||||||
OPTIMIZATIONS
|
OPTIMIZATIONS
|
||||||
|
|
||||||
HDFS-3024. Improve performance of stringification in addStoredBlock (todd)
|
HDFS-3024. Improve performance of stringification in addStoredBlock (todd)
|
||||||
|
@ -26,6 +26,8 @@ import java.util.HashMap;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.TreeSet;
|
import java.util.TreeSet;
|
||||||
|
|
||||||
|
import org.apache.commons.logging.Log;
|
||||||
|
import org.apache.commons.logging.LogFactory;
|
||||||
import org.apache.hadoop.classification.InterfaceAudience;
|
import org.apache.hadoop.classification.InterfaceAudience;
|
||||||
import org.apache.hadoop.conf.Configuration;
|
import org.apache.hadoop.conf.Configuration;
|
||||||
import org.apache.hadoop.fs.CommonConfigurationKeys;
|
import org.apache.hadoop.fs.CommonConfigurationKeys;
|
||||||
@ -68,6 +70,8 @@ public class DFSAdmin extends FsShell {
|
|||||||
HdfsConfiguration.init();
|
HdfsConfiguration.init();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static final Log LOG = LogFactory.getLog(DFSAdmin.class);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An abstract class for the execution of a file system command
|
* An abstract class for the execution of a file system command
|
||||||
*/
|
*/
|
||||||
@ -1089,6 +1093,7 @@ public class DFSAdmin extends FsShell {
|
|||||||
return exitCode;
|
return exitCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Exception debugException = null;
|
||||||
exitCode = 0;
|
exitCode = 0;
|
||||||
try {
|
try {
|
||||||
if ("-report".equals(cmd)) {
|
if ("-report".equals(cmd)) {
|
||||||
@ -1143,6 +1148,7 @@ public class DFSAdmin extends FsShell {
|
|||||||
printUsage("");
|
printUsage("");
|
||||||
}
|
}
|
||||||
} catch (IllegalArgumentException arge) {
|
} catch (IllegalArgumentException arge) {
|
||||||
|
debugException = arge;
|
||||||
exitCode = -1;
|
exitCode = -1;
|
||||||
System.err.println(cmd.substring(1) + ": " + arge.getLocalizedMessage());
|
System.err.println(cmd.substring(1) + ": " + arge.getLocalizedMessage());
|
||||||
printUsage(cmd);
|
printUsage(cmd);
|
||||||
@ -1151,6 +1157,7 @@ public class DFSAdmin extends FsShell {
|
|||||||
// This is a error returned by hadoop server. Print
|
// This is a error returned by hadoop server. Print
|
||||||
// out the first line of the error message, ignore the stack trace.
|
// out the first line of the error message, ignore the stack trace.
|
||||||
exitCode = -1;
|
exitCode = -1;
|
||||||
|
debugException = e;
|
||||||
try {
|
try {
|
||||||
String[] content;
|
String[] content;
|
||||||
content = e.getLocalizedMessage().split("\n");
|
content = e.getLocalizedMessage().split("\n");
|
||||||
@ -1159,12 +1166,17 @@ public class DFSAdmin extends FsShell {
|
|||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
System.err.println(cmd.substring(1) + ": "
|
System.err.println(cmd.substring(1) + ": "
|
||||||
+ ex.getLocalizedMessage());
|
+ ex.getLocalizedMessage());
|
||||||
|
debugException = ex;
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
exitCode = -1;
|
exitCode = -1;
|
||||||
|
debugException = e;
|
||||||
System.err.println(cmd.substring(1) + ": "
|
System.err.println(cmd.substring(1) + ": "
|
||||||
+ e.getLocalizedMessage());
|
+ e.getLocalizedMessage());
|
||||||
}
|
}
|
||||||
|
if (LOG.isDebugEnabled()) {
|
||||||
|
LOG.debug("Exception encountered:", debugException);
|
||||||
|
}
|
||||||
return exitCode;
|
return exitCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user