HADOOP-7114. FsShell should dump all exceptions at DEBUG level. Contributed by todd.
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1076296 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
d97ab376d2
commit
2fbd0bfbeb
|
@ -63,6 +63,9 @@ Trunk (unreleased changes)
|
||||||
HADOOP-7112. Issue a warning when GenericOptionsParser libjars are not on
|
HADOOP-7112. Issue a warning when GenericOptionsParser libjars are not on
|
||||||
local filesystem. (tomwhite)
|
local filesystem. (tomwhite)
|
||||||
|
|
||||||
|
HADOOP-7114. FsShell should dump all exceptions at DEBUG level.
|
||||||
|
(todd via tomwhite)
|
||||||
|
|
||||||
OPTIMIZATIONS
|
OPTIMIZATIONS
|
||||||
|
|
||||||
BUG FIXES
|
BUG FIXES
|
||||||
|
|
|
@ -26,6 +26,8 @@ import java.text.SimpleDateFormat;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.zip.GZIPInputStream;
|
import java.util.zip.GZIPInputStream;
|
||||||
|
|
||||||
|
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.conf.Configured;
|
import org.apache.hadoop.conf.Configured;
|
||||||
|
@ -50,6 +52,8 @@ import org.apache.hadoop.util.StringUtils;
|
||||||
@InterfaceAudience.Private
|
@InterfaceAudience.Private
|
||||||
public class FsShell extends Configured implements Tool {
|
public class FsShell extends Configured implements Tool {
|
||||||
|
|
||||||
|
static final Log LOG = LogFactory.getLog(FsShell.class);
|
||||||
|
|
||||||
protected FileSystem fs;
|
protected FileSystem fs;
|
||||||
private Trash trash;
|
private Trash trash;
|
||||||
public static final SimpleDateFormat dateForm =
|
public static final SimpleDateFormat dateForm =
|
||||||
|
@ -952,6 +956,7 @@ public class FsShell extends Configured implements Tool {
|
||||||
try {
|
try {
|
||||||
dstFstatus = fs.getFileStatus(dst);
|
dstFstatus = fs.getFileStatus(dst);
|
||||||
} catch(IOException e) {
|
} catch(IOException e) {
|
||||||
|
LOG.debug("Error getting file status of " + dst, e);
|
||||||
}
|
}
|
||||||
if((srcFstatus!= null) && (dstFstatus!= null)) {
|
if((srcFstatus!= null) && (dstFstatus!= null)) {
|
||||||
if (srcFstatus.isDirectory() && !dstFstatus.isDirectory()) {
|
if (srcFstatus.isDirectory() && !dstFstatus.isDirectory()) {
|
||||||
|
@ -999,6 +1004,7 @@ public class FsShell extends Configured implements Tool {
|
||||||
//
|
//
|
||||||
rename(argv[i], dest);
|
rename(argv[i], dest);
|
||||||
} catch (RemoteException e) {
|
} catch (RemoteException e) {
|
||||||
|
LOG.debug("Error renaming " + argv[i], e);
|
||||||
//
|
//
|
||||||
// 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 mesage.
|
// out the first line of the error mesage.
|
||||||
|
@ -1013,6 +1019,7 @@ public class FsShell extends Configured implements Tool {
|
||||||
ex.getLocalizedMessage());
|
ex.getLocalizedMessage());
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
|
LOG.debug("Error renaming " + argv[i], e);
|
||||||
//
|
//
|
||||||
// IO exception encountered locally.
|
// IO exception encountered locally.
|
||||||
//
|
//
|
||||||
|
@ -1083,6 +1090,7 @@ public class FsShell extends Configured implements Tool {
|
||||||
//
|
//
|
||||||
copy(argv[i], dest, conf);
|
copy(argv[i], dest, conf);
|
||||||
} catch (RemoteException e) {
|
} catch (RemoteException e) {
|
||||||
|
LOG.debug("Error copying " + argv[i], e);
|
||||||
//
|
//
|
||||||
// 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 mesage.
|
// out the first line of the error mesage.
|
||||||
|
@ -1098,6 +1106,7 @@ public class FsShell extends Configured implements Tool {
|
||||||
ex.getLocalizedMessage());
|
ex.getLocalizedMessage());
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
|
LOG.debug("Error copying " + argv[i], e);
|
||||||
//
|
//
|
||||||
// IO exception encountered locally.
|
// IO exception encountered locally.
|
||||||
//
|
//
|
||||||
|
@ -1159,6 +1168,7 @@ public class FsShell extends Configured implements Tool {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
|
LOG.debug("Error with trash", e);
|
||||||
Exception cause = (Exception) e.getCause();
|
Exception cause = (Exception) e.getCause();
|
||||||
String msg = "";
|
String msg = "";
|
||||||
if(cause != null) {
|
if(cause != null) {
|
||||||
|
@ -1276,6 +1286,7 @@ public class FsShell extends Configured implements Tool {
|
||||||
} catch(FileNotFoundException fnfe) {
|
} catch(FileNotFoundException fnfe) {
|
||||||
System.err.println(cmd + ": could not get listing for '" + path + "'");
|
System.err.println(cmd + ": could not get listing for '" + path + "'");
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
|
LOG.debug("Error listing " + path, e);
|
||||||
System.err.println(cmd +
|
System.err.println(cmd +
|
||||||
": could not get get listing for '" + path + "' : " +
|
": could not get get listing for '" + path + "' : " +
|
||||||
e.getMessage().split("\n")[0]);
|
e.getMessage().split("\n")[0]);
|
||||||
|
@ -1332,6 +1343,7 @@ public class FsShell extends Configured implements Tool {
|
||||||
errors += runCmdHandler(handler, file, srcFs, recursive);
|
errors += runCmdHandler(handler, file, srcFs, recursive);
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
|
LOG.debug("Error getting status for " + path, e);
|
||||||
String msg = (e.getMessage() != null ? e.getLocalizedMessage() :
|
String msg = (e.getMessage() != null ? e.getLocalizedMessage() :
|
||||||
(e.getCause().getMessage() != null ?
|
(e.getCause().getMessage() != null ?
|
||||||
e.getCause().getLocalizedMessage() : "null"));
|
e.getCause().getLocalizedMessage() : "null"));
|
||||||
|
@ -1687,6 +1699,7 @@ public class FsShell extends Configured implements Tool {
|
||||||
text(argv[i]);
|
text(argv[i]);
|
||||||
}
|
}
|
||||||
} catch (RemoteException e) {
|
} catch (RemoteException e) {
|
||||||
|
LOG.debug("Error", e);
|
||||||
//
|
//
|
||||||
// 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.
|
// out the first line of the error message.
|
||||||
|
@ -1702,6 +1715,7 @@ public class FsShell extends Configured implements Tool {
|
||||||
ex.getLocalizedMessage());
|
ex.getLocalizedMessage());
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
|
LOG.debug("Error", e);
|
||||||
//
|
//
|
||||||
// IO exception encountered locally.
|
// IO exception encountered locally.
|
||||||
//
|
//
|
||||||
|
@ -1856,10 +1870,12 @@ public class FsShell extends Configured implements Tool {
|
||||||
try {
|
try {
|
||||||
init();
|
init();
|
||||||
} catch (RPC.VersionMismatch v) {
|
} catch (RPC.VersionMismatch v) {
|
||||||
|
LOG.debug("Version mismatch", v);
|
||||||
System.err.println("Version Mismatch between client and server" +
|
System.err.println("Version Mismatch between client and server" +
|
||||||
"... command aborted.");
|
"... command aborted.");
|
||||||
return exitCode;
|
return exitCode;
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
|
LOG.debug("Error", e);
|
||||||
System.err.println("Bad connection to FS. Command aborted. Exception: " +
|
System.err.println("Bad connection to FS. Command aborted. Exception: " +
|
||||||
e.getLocalizedMessage());
|
e.getLocalizedMessage());
|
||||||
return exitCode;
|
return exitCode;
|
||||||
|
@ -1956,10 +1972,12 @@ public class FsShell extends Configured implements Tool {
|
||||||
printUsage("");
|
printUsage("");
|
||||||
}
|
}
|
||||||
} catch (IllegalArgumentException arge) {
|
} catch (IllegalArgumentException arge) {
|
||||||
|
LOG.debug("Error", 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);
|
||||||
} catch (RemoteException e) {
|
} catch (RemoteException e) {
|
||||||
|
LOG.debug("Error", e);
|
||||||
//
|
//
|
||||||
// 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 mesage, ignore the stack trace.
|
// out the first line of the error mesage, ignore the stack trace.
|
||||||
|
@ -1974,6 +1992,7 @@ public class FsShell extends Configured implements Tool {
|
||||||
ex.getLocalizedMessage());
|
ex.getLocalizedMessage());
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
|
LOG.debug("Error", e);
|
||||||
//
|
//
|
||||||
// IO exception encountered locally.
|
// IO exception encountered locally.
|
||||||
//
|
//
|
||||||
|
@ -1981,6 +2000,7 @@ public class FsShell extends Configured implements Tool {
|
||||||
System.err.println(cmd.substring(1) + ": " +
|
System.err.println(cmd.substring(1) + ": " +
|
||||||
e.getLocalizedMessage());
|
e.getLocalizedMessage());
|
||||||
} catch (Exception re) {
|
} catch (Exception re) {
|
||||||
|
LOG.debug("Error", re);
|
||||||
exitCode = -1;
|
exitCode = -1;
|
||||||
System.err.println(cmd.substring(1) + ": " + re.getLocalizedMessage());
|
System.err.println(cmd.substring(1) + ": " + re.getLocalizedMessage());
|
||||||
} finally {
|
} finally {
|
||||||
|
|
|
@ -21,6 +21,7 @@ import java.io.IOException;
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
|
import org.apache.commons.logging.Log;
|
||||||
import org.apache.hadoop.classification.InterfaceAudience;
|
import org.apache.hadoop.classification.InterfaceAudience;
|
||||||
import org.apache.hadoop.classification.InterfaceStability;
|
import org.apache.hadoop.classification.InterfaceStability;
|
||||||
import org.apache.hadoop.fs.FsShell.CmdHandler;
|
import org.apache.hadoop.fs.FsShell.CmdHandler;
|
||||||
|
@ -36,6 +37,8 @@ import org.apache.hadoop.fs.permission.ChmodParser;
|
||||||
@InterfaceStability.Unstable
|
@InterfaceStability.Unstable
|
||||||
class FsShellPermissions {
|
class FsShellPermissions {
|
||||||
|
|
||||||
|
static Log LOG = FsShell.LOG;
|
||||||
|
|
||||||
/*========== chmod ==========*/
|
/*========== chmod ==========*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -75,6 +78,7 @@ class FsShellPermissions {
|
||||||
srcFs.setPermission(file.getPath(),
|
srcFs.setPermission(file.getPath(),
|
||||||
new FsPermission((short)newperms));
|
new FsPermission((short)newperms));
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
|
LOG.debug("Error changing permissions of " + file.getPath(), e);
|
||||||
System.err.println(getName() + ": changing permissions of '" +
|
System.err.println(getName() + ": changing permissions of '" +
|
||||||
file.getPath() + "':" + e.getMessage());
|
file.getPath() + "':" + e.getMessage());
|
||||||
}
|
}
|
||||||
|
@ -133,6 +137,7 @@ class FsShellPermissions {
|
||||||
try {
|
try {
|
||||||
srcFs.setOwner(file.getPath(), newOwner, newGroup);
|
srcFs.setOwner(file.getPath(), newOwner, newGroup);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
|
LOG.debug("Error changing ownership of " + file.getPath(), e);
|
||||||
System.err.println(getName() + ": changing ownership of '" +
|
System.err.println(getName() + ": changing ownership of '" +
|
||||||
file.getPath() + "':" + e.getMessage());
|
file.getPath() + "':" + e.getMessage());
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue