|
@@ -30,6 +30,8 @@ import java.util.List;
|
|
|
import java.util.TimeZone;
|
|
|
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.conf.Configuration;
|
|
|
import org.apache.hadoop.conf.Configured;
|
|
@@ -55,6 +57,8 @@ import org.apache.hadoop.util.ToolRunner;
|
|
|
/** Provide command line access to a FileSystem. */
|
|
|
@InterfaceAudience.Private
|
|
|
public class FsShell extends Configured implements Tool {
|
|
|
+
|
|
|
+ static final Log LOG = LogFactory.getLog(FsShell.class);
|
|
|
|
|
|
private FileSystem fs;
|
|
|
private Trash trash;
|
|
@@ -722,6 +726,7 @@ public class FsShell extends Configured implements Tool {
|
|
|
try {
|
|
|
dstFstatus = fs.getFileStatus(dst);
|
|
|
} catch(IOException e) {
|
|
|
+ LOG.debug("Error getting file status of " + dst, e);
|
|
|
}
|
|
|
if((srcFstatus!= null) && (dstFstatus!= null)) {
|
|
|
if (srcFstatus.isDirectory() && !dstFstatus.isDirectory()) {
|
|
@@ -769,6 +774,7 @@ public class FsShell extends Configured implements Tool {
|
|
|
//
|
|
|
rename(argv[i], dest);
|
|
|
} catch (RemoteException e) {
|
|
|
+ LOG.debug("Error renaming " + argv[i], e);
|
|
|
//
|
|
|
// This is a error returned by hadoop server. Print
|
|
|
// out the first line of the error mesage.
|
|
@@ -783,6 +789,7 @@ public class FsShell extends Configured implements Tool {
|
|
|
ex.getLocalizedMessage());
|
|
|
}
|
|
|
} catch (IOException e) {
|
|
|
+ LOG.debug("Error renaming " + argv[i], e);
|
|
|
//
|
|
|
// IO exception encountered locally.
|
|
|
//
|
|
@@ -854,6 +861,7 @@ public class FsShell extends Configured implements Tool {
|
|
|
//
|
|
|
copy(argv[i], dest, conf);
|
|
|
} catch (RemoteException e) {
|
|
|
+ LOG.debug("Error copying " + argv[i], e);
|
|
|
//
|
|
|
// This is a error returned by hadoop server. Print
|
|
|
// out the first line of the error mesage.
|
|
@@ -869,6 +877,7 @@ public class FsShell extends Configured implements Tool {
|
|
|
ex.getLocalizedMessage());
|
|
|
}
|
|
|
} catch (IOException e) {
|
|
|
+ LOG.debug("Error copying " + argv[i], e);
|
|
|
//
|
|
|
// IO exception encountered locally.
|
|
|
//
|
|
@@ -929,6 +938,7 @@ public class FsShell extends Configured implements Tool {
|
|
|
return;
|
|
|
}
|
|
|
} catch (IOException e) {
|
|
|
+ LOG.debug("Error with trash", e);
|
|
|
Exception cause = (Exception) e.getCause();
|
|
|
String msg = "";
|
|
|
if(cause != null) {
|
|
@@ -995,6 +1005,7 @@ public class FsShell extends Configured implements Tool {
|
|
|
} catch(FileNotFoundException fnfe) {
|
|
|
System.err.println(cmd + ": could not get listing for '" + path + "'");
|
|
|
} catch (IOException e) {
|
|
|
+ LOG.debug("Error listing " + path, e);
|
|
|
System.err.println(cmd +
|
|
|
": could not get get listing for '" + path + "' : " +
|
|
|
e.getMessage().split("\n")[0]);
|
|
@@ -1051,6 +1062,7 @@ public class FsShell extends Configured implements Tool {
|
|
|
errors += runCmdHandler(handler, file, srcFs, recursive);
|
|
|
}
|
|
|
} catch (IOException e) {
|
|
|
+ LOG.debug("Error getting status for " + path, e);
|
|
|
String msg = (e.getMessage() != null ? e.getLocalizedMessage() :
|
|
|
(e.getCause().getMessage() != null ?
|
|
|
e.getCause().getLocalizedMessage() : "null"));
|
|
@@ -1383,6 +1395,7 @@ public class FsShell extends Configured implements Tool {
|
|
|
text(argv[i]);
|
|
|
}
|
|
|
} catch (RemoteException e) {
|
|
|
+ LOG.debug("Error", e);
|
|
|
//
|
|
|
// This is a error returned by hadoop server. Print
|
|
|
// out the first line of the error message.
|
|
@@ -1398,6 +1411,7 @@ public class FsShell extends Configured implements Tool {
|
|
|
ex.getLocalizedMessage());
|
|
|
}
|
|
|
} catch (IOException e) {
|
|
|
+ LOG.debug("Error", e);
|
|
|
//
|
|
|
// IO exception encountered locally.
|
|
|
//
|
|
@@ -1551,11 +1565,13 @@ public class FsShell extends Configured implements Tool {
|
|
|
// initialize FsShell
|
|
|
try {
|
|
|
init();
|
|
|
- } catch (RPC.VersionMismatch v) {
|
|
|
+ } catch (RPC.VersionMismatch v) {
|
|
|
+ LOG.debug("Version mismatch", v);
|
|
|
System.err.println("Version Mismatch between client and server" +
|
|
|
"... command aborted.");
|
|
|
return exitCode;
|
|
|
} catch (IOException e) {
|
|
|
+ LOG.debug("Error", e);
|
|
|
System.err.println("Bad connection to FS. Command aborted. Exception: " +
|
|
|
e.getLocalizedMessage());
|
|
|
return exitCode;
|
|
@@ -1644,10 +1660,12 @@ public class FsShell extends Configured implements Tool {
|
|
|
printUsage("");
|
|
|
}
|
|
|
} catch (IllegalArgumentException arge) {
|
|
|
+ LOG.debug("Error", arge);
|
|
|
exitCode = -1;
|
|
|
System.err.println(cmd.substring(1) + ": " + arge.getLocalizedMessage());
|
|
|
printUsage(cmd);
|
|
|
} catch (RemoteException e) {
|
|
|
+ LOG.debug("Error", e);
|
|
|
//
|
|
|
// This is a error returned by hadoop server. Print
|
|
|
// out the first line of the error mesage, ignore the stack trace.
|
|
@@ -1662,6 +1680,7 @@ public class FsShell extends Configured implements Tool {
|
|
|
ex.getLocalizedMessage());
|
|
|
}
|
|
|
} catch (IOException e) {
|
|
|
+ LOG.debug("Error", e);
|
|
|
//
|
|
|
// IO exception encountered locally.
|
|
|
//
|
|
@@ -1669,6 +1688,7 @@ public class FsShell extends Configured implements Tool {
|
|
|
System.err.println(cmd.substring(1) + ": " +
|
|
|
e.getLocalizedMessage());
|
|
|
} catch (Exception re) {
|
|
|
+ LOG.debug("Error", re);
|
|
|
exitCode = -1;
|
|
|
System.err.println(cmd.substring(1) + ": " + re.getLocalizedMessage());
|
|
|
} finally {
|