5
0
mirror of https://github.com/apache/sqoop.git synced 2025-05-03 16:09:27 +08:00

MAPREDUCE-1467. Add a --verbose flag to Sqoop. Contributed by Aaron Kimball.

From: Thomas White <tomwhite@apache.org>

git-svn-id: https://svn.apache.org/repos/asf/incubator/sqoop/trunk@1149858 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Andrew Bayer 2011-07-22 20:03:33 +00:00
parent 6a215d0fbc
commit 61d5da2500
3 changed files with 17 additions and 0 deletions

View File

@ -187,6 +187,9 @@ no import or code generation is performed.
--list-tables::
List tables in database and exit
--verbose::
Print more information while working
Database-specific options
~~~~~~~~~~~~~~~~~~~~~~~~~

View File

@ -34,3 +34,7 @@ Data emitted to HDFS is by default uncompressed. You can instruct
Sqoop to use gzip to compress your data by providing either the
+--compress+ or +-z+ argument (both are equivalent).
Using +--verbose+ will instruct Sqoop to print more details about its
operation; this is particularly handy if Sqoop appears to be misbehaving.

View File

@ -31,6 +31,9 @@
import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.util.ToolRunner;
import org.apache.log4j.Category;
import org.apache.log4j.Level;
import org.apache.log4j.Logger;
/**
* Command-line arguments used by Sqoop
@ -363,6 +366,7 @@ public static void printUsage() {
System.out.println("--list-tables List tables in database and exit");
System.out.println("--list-databases List all databases available and exit");
System.out.println("--debug-sql (statement) Execute 'statement' in SQL and exit");
System.out.println("--verbose Print more information while working");
System.out.println("");
System.out.println("Database-specific options:");
System.out.println("Arguments may be passed to the database manager after a lone '-':");
@ -595,6 +599,12 @@ public void parse(String [] args) throws InvalidOptionsException {
for (i++; i < args.length; i++) {
this.debugSqlCmd = this.debugSqlCmd + args[i] + " ";
}
} else if (args[i].equals("--verbose")) {
// Immediately switch into DEBUG logging.
Category sqoopLogger =
Logger.getLogger(SqoopOptions.class.getName()).getParent();
sqoopLogger.setLevel(Level.DEBUG);
} else if (args[i].equals("--help")) {
printUsage();
throw new InvalidOptionsException("");