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,8 +101,7 @@ 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); int value = parseInt(cli.getOptionValue('v'), -1);
switch (value) switch (value)
{ {
@ -128,7 +127,7 @@ public class DSTool
rootLogger.setLevel(Level.ALL); rootLogger.setLevel(Level.ALL);
break; 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,8 +138,7 @@ 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); int value = parseInt(cli.getOptionValue('v'), -1);
switch (value) switch (value)
{ {
@ -167,7 +164,7 @@ public class KeyGen
rootLogger.setLevel(Level.ALL); rootLogger.setLevel(Level.ALL);
break; 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,8 +91,7 @@ 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); int value = parseInt(cli.getOptionValue('v'), -1);
switch (value) switch (value)
{ {
@ -119,7 +117,7 @@ public class KeyInfoTool
rootLogger.setLevel(Level.ALL); rootLogger.setLevel(Level.ALL);
break; 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,8 +136,7 @@ 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); int value = parseInt(cli.getOptionValue('v'), -1);
switch (value) switch (value)
{ {
@ -163,7 +162,7 @@ public class SignKeyset
rootLogger.setLevel(Level.ALL); rootLogger.setLevel(Level.ALL);
break; 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,8 +138,7 @@ 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); int value = parseInt(cli.getOptionValue('v'), -1);
switch (value) switch (value)
{ {
@ -165,7 +164,7 @@ public class SignRRset
rootLogger.setLevel(Level.ALL); rootLogger.setLevel(Level.ALL);
break; 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,8 +218,7 @@ 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); int value = parseInt(cli.getOptionValue('v'), -1);
switch (value) switch (value)
{ {
@ -245,7 +244,7 @@ public class SignZone
rootLogger.setLevel(Level.ALL); rootLogger.setLevel(Level.ALL);
break; 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,9 +117,8 @@ 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); int value = parseInt(cli.getOptionValue('v'), -1);
switch (value) switch (value)
{ {
case 0: case 0:
@ -144,7 +143,7 @@ public class VerifyZone
rootLogger.setLevel(Level.ALL); rootLogger.setLevel(Level.ALL);
break; 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,8 +85,7 @@ 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); int value = parseInt(cli.getOptionValue('v'), -1);
switch (value) switch (value)
{ {
@ -112,7 +111,7 @@ public class ZoneFormat
rootLogger.setLevel(Level.ALL); rootLogger.setLevel(Level.ALL);
break; break;
} }
}
// I hate java.util.logging, btw. // I hate java.util.logging, btw.
for (Handler h : rootLogger.getHandlers()) for (Handler h : rootLogger.getHandlers())
{ {