fix my logger normalization -- it was still defaulting to INFO.

git-svn-id: https://svn.verisignlabs.com/jdnssec/tools/trunk@244 4cbd57fe-54e5-0310-bd9a-f30fe5ea5e6e
This commit is contained in:
David Blacka 2011-02-10 00:25:10 +00:00
parent af2ae7401a
commit 645b8a1a60
8 changed files with 226 additions and 244 deletions

View File

@ -101,34 +101,33 @@ public class DSTool
if (cli.hasOption('h')) usage(); if (cli.hasOption('h')) usage();
Logger rootLogger = Logger.getLogger(""); Logger rootLogger = Logger.getLogger("");
if (cli.hasOption('v'))
int value = parseInt(cli.getOptionValue('v'), -1);
switch (value)
{ {
int value = parseInt(cli.getOptionValue('v'), -1); case 0:
switch (value) rootLogger.setLevel(Level.OFF);
{ break;
case 0: case 1:
rootLogger.setLevel(Level.OFF); rootLogger.setLevel(Level.SEVERE);
break; break;
case 1: case 2:
rootLogger.setLevel(Level.SEVERE); default:
break; rootLogger.setLevel(Level.WARNING);
case 2: break;
default: case 3:
rootLogger.setLevel(Level.WARNING); rootLogger.setLevel(Level.INFO);
break; break;
case 3: case 4:
rootLogger.setLevel(Level.INFO); rootLogger.setLevel(Level.CONFIG);
break; case 5:
case 4: rootLogger.setLevel(Level.FINE);
rootLogger.setLevel(Level.CONFIG); break;
case 5: case 6:
rootLogger.setLevel(Level.FINE); rootLogger.setLevel(Level.ALL);
break; break;
case 6:
rootLogger.setLevel(Level.ALL);
break;
}
} }
// I hate java.util.logging, btw. // I hate java.util.logging, btw.
for (Handler h : rootLogger.getHandlers()) for (Handler h : rootLogger.getHandlers())
{ {
@ -161,8 +160,7 @@ public class DSTool
// print our own usage statement: // print our own usage statement:
f.printHelp(out, 75, "jdnssec-dstool [..options..] keyfile", null, opts, f.printHelp(out, 75, "jdnssec-dstool [..options..] keyfile", null, opts,
HelpFormatter.DEFAULT_LEFT_PAD, HelpFormatter.DEFAULT_LEFT_PAD, HelpFormatter.DEFAULT_DESC_PAD, null);
HelpFormatter.DEFAULT_DESC_PAD, null);
out.flush(); out.flush();
System.exit(64); System.exit(64);
@ -202,8 +200,7 @@ public class DSTool
log.warning("DNSKEY is not an SEP-flagged key."); log.warning("DNSKEY is not an SEP-flagged key.");
} }
DSRecord ds = SignUtils.calculateDSRecord(dnskey, state.digest_id, DSRecord ds = SignUtils.calculateDSRecord(dnskey, state.digest_id, dnskey.getTTL());
dnskey.getTTL());
Record res = ds; Record res = ds;
if (state.createDLV) if (state.createDLV)

View File

@ -92,8 +92,7 @@ public class KeyGen
OptionBuilder.withLongOpt("verbose"); OptionBuilder.withLongOpt("verbose");
OptionBuilder.withArgName("level"); OptionBuilder.withArgName("level");
OptionBuilder.withDescription("verbosity level -- 0 is silence, " OptionBuilder.withDescription("verbosity level -- 0 is silence, "
+ "5 is debug information, 6 is trace information.\n" + "5 is debug information, 6 is trace information.\n" + "default is level 5.");
+ "default is level 5.");
opts.addOption(OptionBuilder.create('v')); opts.addOption(OptionBuilder.create('v'));
OptionBuilder.hasArg(); OptionBuilder.hasArg();
@ -118,8 +117,7 @@ public class KeyGen
OptionBuilder.hasArg(); OptionBuilder.hasArg();
OptionBuilder.withLongOpt("keydir"); OptionBuilder.withLongOpt("keydir");
OptionBuilder.withArgName("dir"); OptionBuilder.withArgName("dir");
OptionBuilder.withDescription("place generated key files in this " OptionBuilder.withDescription("place generated key files in this " + "directory");
+ "directory");
opts.addOption(OptionBuilder.create('d')); opts.addOption(OptionBuilder.create('d'));
OptionBuilder.hasArg(); OptionBuilder.hasArg();
@ -140,34 +138,33 @@ public class KeyGen
if (cli.hasOption('h')) usage(); if (cli.hasOption('h')) usage();
Logger rootLogger = Logger.getLogger(""); Logger rootLogger = Logger.getLogger("");
if (cli.hasOption('v'))
int value = parseInt(cli.getOptionValue('v'), -1);
switch (value)
{ {
int value = parseInt(cli.getOptionValue('v'), -1); case 0:
switch (value) rootLogger.setLevel(Level.OFF);
{ break;
case 0: case 1:
rootLogger.setLevel(Level.OFF); rootLogger.setLevel(Level.SEVERE);
break; break;
case 1: case 2:
rootLogger.setLevel(Level.SEVERE); default:
break; rootLogger.setLevel(Level.WARNING);
case 2: break;
default: case 3:
rootLogger.setLevel(Level.WARNING); rootLogger.setLevel(Level.INFO);
break; break;
case 3: case 4:
rootLogger.setLevel(Level.INFO); rootLogger.setLevel(Level.CONFIG);
break; case 5:
case 4: rootLogger.setLevel(Level.FINE);
rootLogger.setLevel(Level.CONFIG); break;
case 5: case 6:
rootLogger.setLevel(Level.FINE); rootLogger.setLevel(Level.ALL);
break; break;
case 6:
rootLogger.setLevel(Level.ALL);
break;
}
} }
// I hate java.util.logging, btw. // I hate java.util.logging, btw.
for (Handler h : rootLogger.getHandlers()) for (Handler h : rootLogger.getHandlers())
{ {
@ -257,8 +254,7 @@ public class KeyGen
// print our own usage statement: // print our own usage statement:
f.printHelp(out, 75, "jdnssec-keygen [..options..] name", null, opts, f.printHelp(out, 75, "jdnssec-keygen [..options..] name", null, opts,
HelpFormatter.DEFAULT_LEFT_PAD, HelpFormatter.DEFAULT_LEFT_PAD, HelpFormatter.DEFAULT_DESC_PAD, null);
HelpFormatter.DEFAULT_DESC_PAD, null);
out.flush(); out.flush();
System.exit(64); System.exit(64);
@ -314,13 +310,13 @@ public class KeyGen
if (state.zoneKey) flags |= DNSKEYRecord.Flags.ZONE_KEY; if (state.zoneKey) flags |= DNSKEYRecord.Flags.ZONE_KEY;
if (state.kskFlag) flags |= DNSKEYRecord.Flags.SEP_KEY; if (state.kskFlag) flags |= DNSKEYRecord.Flags.SEP_KEY;
log.fine("create key pair with (name = " + owner_name + ", ttl = " log.fine("create key pair with (name = " + owner_name + ", ttl = " + state.ttl
+ state.ttl + ", alg = " + state.algorithm + ", flags = " + flags + ", alg = " + state.algorithm + ", flags = " + flags + ", length = "
+ ", length = " + state.keylength + ")"); + state.keylength + ")");
DnsKeyPair pair = signer.generateKey(owner_name, state.ttl, DClass.IN, DnsKeyPair pair = signer.generateKey(owner_name, state.ttl, DClass.IN,
state.algorithm, flags, state.algorithm, flags, state.keylength,
state.keylength, state.useLargeE); state.useLargeE);
if (state.outputfile != null) if (state.outputfile != null)
{ {

View File

@ -71,8 +71,7 @@ public class KeyInfoTool
OptionBuilder.withLongOpt("verbose"); OptionBuilder.withLongOpt("verbose");
OptionBuilder.withArgName("level"); OptionBuilder.withArgName("level");
OptionBuilder.withDescription("verbosity level -- 0 is silence, " OptionBuilder.withDescription("verbosity level -- 0 is silence, "
+ "5 is debug information, 6 is trace information.\n" + "5 is debug information, 6 is trace information.\n" + "default is level 5.");
+ "default is level 5.");
// Argument options // Argument options
opts.addOption(OptionBuilder.create('v')); opts.addOption(OptionBuilder.create('v'));
@ -92,34 +91,33 @@ public class KeyInfoTool
if (cli.hasOption('h')) usage(); if (cli.hasOption('h')) usage();
Logger rootLogger = Logger.getLogger(""); Logger rootLogger = Logger.getLogger("");
if (cli.hasOption('v'))
int value = parseInt(cli.getOptionValue('v'), -1);
switch (value)
{ {
int value = parseInt(cli.getOptionValue('v'), -1); case 0:
switch (value) rootLogger.setLevel(Level.OFF);
{ break;
case 0: case 1:
rootLogger.setLevel(Level.OFF); rootLogger.setLevel(Level.SEVERE);
break; break;
case 1: case 2:
rootLogger.setLevel(Level.SEVERE); default:
break; rootLogger.setLevel(Level.WARNING);
case 2: break;
default: case 3:
rootLogger.setLevel(Level.WARNING); rootLogger.setLevel(Level.INFO);
break; break;
case 3: case 4:
rootLogger.setLevel(Level.INFO); rootLogger.setLevel(Level.CONFIG);
break; case 5:
case 4: rootLogger.setLevel(Level.FINE);
rootLogger.setLevel(Level.CONFIG); break;
case 5: case 6:
rootLogger.setLevel(Level.FINE); rootLogger.setLevel(Level.ALL);
break; break;
case 6:
rootLogger.setLevel(Level.ALL);
break;
}
} }
// I hate java.util.logging, btw. // I hate java.util.logging, btw.
for (Handler h : rootLogger.getHandlers()) for (Handler h : rootLogger.getHandlers())
{ {
@ -153,8 +151,7 @@ public class KeyInfoTool
// print our own usage statement: // print our own usage statement:
f.printHelp(out, 75, "jdnssec-keyinfo [..options..] keyfile", null, opts, f.printHelp(out, 75, "jdnssec-keyinfo [..options..] keyfile", null, opts,
HelpFormatter.DEFAULT_LEFT_PAD, HelpFormatter.DEFAULT_LEFT_PAD, HelpFormatter.DEFAULT_DESC_PAD, null);
HelpFormatter.DEFAULT_DESC_PAD, null);
out.flush(); out.flush();
System.exit(64); System.exit(64);
@ -218,23 +215,20 @@ public class KeyInfoTool
System.out.println("Name: " + dnskey.getName()); System.out.println("Name: " + dnskey.getName());
System.out.println("SEP: " + isSEP); System.out.println("SEP: " + isSEP);
System.out.println("Algorithm: " System.out.println("Algorithm: " + dnskeyalg.algToString(dnskey.getAlgorithm())
+ dnskeyalg.algToString(dnskey.getAlgorithm()) + " (" + " (" + dnskey.getAlgorithm() + ")");
+ dnskey.getAlgorithm() + ")");
System.out.println("ID: " + dnskey.getFootprint()); System.out.println("ID: " + dnskey.getFootprint());
System.out.println("KeyFileBase: " + BINDKeyUtils.keyFileBase(key)); System.out.println("KeyFileBase: " + BINDKeyUtils.keyFileBase(key));
int basetype = dnskeyalg.baseType(dnskey.getAlgorithm()); int basetype = dnskeyalg.baseType(dnskey.getAlgorithm());
switch (basetype) switch (basetype)
{ {
case DnsKeyAlgorithm.RSA: case DnsKeyAlgorithm.RSA: {
{
RSAPublicKey pub = (RSAPublicKey) key.getPublic(); RSAPublicKey pub = (RSAPublicKey) key.getPublic();
System.out.println("RSA Public Exponent: " + pub.getPublicExponent()); System.out.println("RSA Public Exponent: " + pub.getPublicExponent());
System.out.println("RSA Modulus: " + pub.getModulus()); System.out.println("RSA Modulus: " + pub.getModulus());
break; break;
} }
case DnsKeyAlgorithm.DSA: case DnsKeyAlgorithm.DSA: {
{
DSAPublicKey pub = (DSAPublicKey) key.getPublic(); DSAPublicKey pub = (DSAPublicKey) key.getPublic();
System.out.println("DSA base (G): " + pub.getParams().getG()); System.out.println("DSA base (G): " + pub.getParams().getG());
System.out.println("DSA prime (P): " + pub.getParams().getP()); System.out.println("DSA prime (P): " + pub.getParams().getP());

View File

@ -136,34 +136,33 @@ public class SignKeyset
if (cli.hasOption('h')) usage(); if (cli.hasOption('h')) usage();
Logger rootLogger = Logger.getLogger(""); Logger rootLogger = Logger.getLogger("");
if (cli.hasOption('v'))
int value = parseInt(cli.getOptionValue('v'), -1);
switch (value)
{ {
int value = parseInt(cli.getOptionValue('v'), -1); case 0:
switch (value) rootLogger.setLevel(Level.OFF);
{ break;
case 0: case 1:
rootLogger.setLevel(Level.OFF); rootLogger.setLevel(Level.SEVERE);
break; break;
case 1: case 2:
rootLogger.setLevel(Level.SEVERE); default:
break; rootLogger.setLevel(Level.WARNING);
case 2: break;
default: case 3:
rootLogger.setLevel(Level.WARNING); rootLogger.setLevel(Level.INFO);
break; break;
case 3: case 4:
rootLogger.setLevel(Level.INFO); rootLogger.setLevel(Level.CONFIG);
break; case 5:
case 4: rootLogger.setLevel(Level.FINE);
rootLogger.setLevel(Level.CONFIG); break;
case 5: case 6:
rootLogger.setLevel(Level.FINE); rootLogger.setLevel(Level.ALL);
break; break;
case 6:
rootLogger.setLevel(Level.ALL);
break;
}
} }
// I hate java.util.logging, btw. // I hate java.util.logging, btw.
for (Handler h : rootLogger.getHandlers()) for (Handler h : rootLogger.getHandlers())
{ {

View File

@ -138,34 +138,33 @@ public class SignRRset
if (cli.hasOption('h')) usage(); if (cli.hasOption('h')) usage();
Logger rootLogger = Logger.getLogger(""); Logger rootLogger = Logger.getLogger("");
if (cli.hasOption('v'))
int value = parseInt(cli.getOptionValue('v'), -1);
switch (value)
{ {
int value = parseInt(cli.getOptionValue('v'), -1); case 0:
switch (value) rootLogger.setLevel(Level.OFF);
{ break;
case 0: case 1:
rootLogger.setLevel(Level.OFF); rootLogger.setLevel(Level.SEVERE);
break; break;
case 1: case 2:
rootLogger.setLevel(Level.SEVERE); default:
break; rootLogger.setLevel(Level.WARNING);
case 2: break;
default: case 3:
rootLogger.setLevel(Level.WARNING); rootLogger.setLevel(Level.INFO);
break; break;
case 3: case 4:
rootLogger.setLevel(Level.INFO); rootLogger.setLevel(Level.CONFIG);
break; case 5:
case 4: rootLogger.setLevel(Level.FINE);
rootLogger.setLevel(Level.CONFIG); break;
case 5: case 6:
rootLogger.setLevel(Level.FINE); rootLogger.setLevel(Level.ALL);
break; break;
case 6:
rootLogger.setLevel(Level.ALL);
break;
}
} }
// I hate java.util.logging, btw. // I hate java.util.logging, btw.
for (Handler h : rootLogger.getHandlers()) for (Handler h : rootLogger.getHandlers())
{ {

View File

@ -218,34 +218,33 @@ public class SignZone
if (cli.hasOption('h')) usage(); if (cli.hasOption('h')) usage();
Logger rootLogger = Logger.getLogger(""); Logger rootLogger = Logger.getLogger("");
if (cli.hasOption('v'))
int value = parseInt(cli.getOptionValue('v'), -1);
switch (value)
{ {
int value = parseInt(cli.getOptionValue('v'), -1); case 0:
switch (value) rootLogger.setLevel(Level.OFF);
{ break;
case 0: case 1:
rootLogger.setLevel(Level.OFF); rootLogger.setLevel(Level.SEVERE);
break; break;
case 1: case 2:
rootLogger.setLevel(Level.SEVERE); default:
break; rootLogger.setLevel(Level.WARNING);
case 2: break;
default: case 3:
rootLogger.setLevel(Level.WARNING); rootLogger.setLevel(Level.INFO);
break; break;
case 3: case 4:
rootLogger.setLevel(Level.INFO); rootLogger.setLevel(Level.CONFIG);
break; case 5:
case 4: rootLogger.setLevel(Level.FINE);
rootLogger.setLevel(Level.CONFIG); break;
case 5: case 6:
rootLogger.setLevel(Level.FINE); rootLogger.setLevel(Level.ALL);
break; break;
case 6:
rootLogger.setLevel(Level.ALL);
break;
}
} }
// I hate java.util.logging, btw. // I hate java.util.logging, btw.
for (Handler h : rootLogger.getHandlers()) for (Handler h : rootLogger.getHandlers())
{ {

View File

@ -117,34 +117,33 @@ public class VerifyZone
if (cli.hasOption('h')) usage(); if (cli.hasOption('h')) usage();
Logger rootLogger = Logger.getLogger(""); Logger rootLogger = Logger.getLogger("");
if (cli.hasOption('v')) int value = parseInt(cli.getOptionValue('v'), -1);
switch (value)
{ {
int value = parseInt(cli.getOptionValue('v'), -1); case 0:
switch (value) rootLogger.setLevel(Level.OFF);
{ break;
case 0: case 1:
rootLogger.setLevel(Level.OFF); rootLogger.setLevel(Level.SEVERE);
break; break;
case 1: case 2:
rootLogger.setLevel(Level.SEVERE); default:
break; rootLogger.setLevel(Level.WARNING);
case 2: break;
default: case 3:
rootLogger.setLevel(Level.WARNING); rootLogger.setLevel(Level.INFO);
break; break;
case 3: case 4:
rootLogger.setLevel(Level.INFO); rootLogger.setLevel(Level.CONFIG);
break; case 5:
case 4: rootLogger.setLevel(Level.FINE);
rootLogger.setLevel(Level.CONFIG); break;
case 5: case 6:
rootLogger.setLevel(Level.FINE); rootLogger.setLevel(Level.ALL);
break; break;
case 6:
rootLogger.setLevel(Level.ALL);
break;
}
} }
// I hate java.util.logging, btw. // I hate java.util.logging, btw.
for (Handler h : rootLogger.getHandlers()) for (Handler h : rootLogger.getHandlers())
{ {

View File

@ -85,34 +85,33 @@ public class ZoneFormat
if (cli.hasOption('N')) assignNSEC3 = true; if (cli.hasOption('N')) assignNSEC3 = true;
Logger rootLogger = Logger.getLogger(""); Logger rootLogger = Logger.getLogger("");
if (cli.hasOption('v'))
int value = parseInt(cli.getOptionValue('v'), -1);
switch (value)
{ {
int value = parseInt(cli.getOptionValue('v'), -1); case 0:
switch (value) rootLogger.setLevel(Level.OFF);
{ break;
case 0: case 1:
rootLogger.setLevel(Level.OFF); rootLogger.setLevel(Level.SEVERE);
break; break;
case 1: case 2:
rootLogger.setLevel(Level.SEVERE); default:
break; rootLogger.setLevel(Level.WARNING);
case 2: break;
default: case 3:
rootLogger.setLevel(Level.WARNING); rootLogger.setLevel(Level.INFO);
break; break;
case 3: case 4:
rootLogger.setLevel(Level.INFO); rootLogger.setLevel(Level.CONFIG);
break; case 5:
case 4: rootLogger.setLevel(Level.FINE);
rootLogger.setLevel(Level.CONFIG); break;
case 5: case 6:
rootLogger.setLevel(Level.FINE); rootLogger.setLevel(Level.ALL);
break; break;
case 6:
rootLogger.setLevel(Level.ALL);
break;
}
} }
// I hate java.util.logging, btw. // I hate java.util.logging, btw.
for (Handler h : rootLogger.getHandlers()) for (Handler h : rootLogger.getHandlers())
{ {