diff --git a/build.xml b/build.xml index 83c73b9..c011f48 100644 --- a/build.xml +++ b/build.xml @@ -84,7 +84,7 @@ - + diff --git a/lib/log4j.properties b/lib/log4j.properties deleted file mode 100644 index ebcdfba..0000000 --- a/lib/log4j.properties +++ /dev/null @@ -1,24 +0,0 @@ - -#################################################################### -# -# L O G 4 j A P P E N D E R s -# -################################################################### - -################### -# Write Output to Console (aka TTY) -# -log4j.appender.console=org.apache.log4j.ConsoleAppender -log4j.appender.console.layout=org.apache.log4j.PatternLayout -log4j.appender.console.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n - -#################################################################### -# -# R O O T D E B U G G I N G L E V E L -# -################################################################### - -###################### -# Set root logger level to an (Appender) -# -log4j.rootLogger=FATAL, console diff --git a/src/com/verisign/cl/DNSSECValTool.java b/src/com/verisign/cl/DNSSECValTool.java index f1f9543..e29bf4a 100644 --- a/src/com/verisign/cl/DNSSECValTool.java +++ b/src/com/verisign/cl/DNSSECValTool.java @@ -5,6 +5,8 @@ import java.net.SocketTimeoutException; import java.util.*; import org.apache.log4j.BasicConfigurator; +import org.apache.log4j.Level; +import org.apache.log4j.Logger; import org.xbill.DNS.*; import com.verisign.tat.dnssec.CaptiveValidator; @@ -32,6 +34,7 @@ public class DNSSECValTool { public List dnskeyNames; public String errorFile; public long count = 0; + public boolean debug = false; DNSSECValTool() { validator = new CaptiveValidator(); @@ -215,11 +218,20 @@ public class DNSSECValTool { Name zone = zoneFromQuery(query); // Skip queries in zones that we don't have keys for if (zone == null) { + if (debug) { + System.out.println("DEBUG: skipping query " + queryToString(query)); + } + query = nextQuery(); continue; } + if (debug) { + System.out.println("DEBUG: querying for: " + queryToString(query)); + } + Message response = resolve(query); if (response == null) { + System.out.println("ERROR: No response for query: " + queryToString(query)); continue; } byte result = validator.validateMessage(response, zone.toString()); @@ -248,6 +260,7 @@ public class DNSSECValTool { errorCount++; break; case SecurityStatus.SECURE: + if (debug) System.out.println("DEBUG: response for " + queryToString(query) + " was valid."); validCount++; break; } @@ -258,6 +271,7 @@ public class DNSSECValTool { } if (count > 0 && total >= count) { + if (debug) System.out.println("DEBUG: reached maximum number of queries, exiting"); break; } @@ -284,6 +298,9 @@ public class DNSSECValTool { // Set up Log4J to just log to console. BasicConfigurator.configure(); + // And raise the log level quite high + Logger rootLogger = Logger.getRootLogger(); + rootLogger.setLevel(Level.FATAL); DNSSECValTool dr = new DNSSECValTool(); @@ -318,6 +335,8 @@ public class DNSSECValTool { dr.dnskeyNames = new ArrayList(); } dr.dnskeyNames.add(optarg); + } else if (opt.equals("debug")) { + dr.debug = Boolean.parseBoolean(optarg); } else { System.err.println("Unrecognized option: " + opt); usage();