Commit 351d9664 authored by Jonathan Shahen's avatar Jonathan Shahen

Change quiet logger level to WARNING from SEVERE

parent d32fba51
......@@ -12,6 +12,14 @@ import java.util.logging.Handler;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.apache.commons.cli.BasicParser;
import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.CommandLineParser;
import org.apache.commons.cli.HelpFormatter;
import org.apache.commons.cli.OptionBuilder;
import org.apache.commons.cli.Options;
import org.apache.commons.lang3.StringUtils;
import mohawk.converter.generated.MohawkTARBACParser;
import mohawk.converter.helper.SpecHelper;
import mohawk.converter.logging.MohawkCSVFileFormatter;
......@@ -24,14 +32,6 @@ import mohawk.global.FileExtensions;
import mohawk.global.pieces.MohawkT;
import mohawk.global.timing.MohawkTiming;
import org.apache.commons.cli.BasicParser;
import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.CommandLineParser;
import org.apache.commons.cli.HelpFormatter;
import org.apache.commons.cli.OptionBuilder;
import org.apache.commons.cli.Options;
import org.apache.commons.lang3.StringUtils;
public class ConverterInstance {
private static final String VERSION = "v1.1.2";
private static final String AUTHORS = "Jonathan Shahen <jmshahen@uwaterloo.ca>";
......@@ -233,7 +233,7 @@ public class ConverterInstance {
logger.info("[EOF] Converter Instance done running");
for (Handler h : logger.getHandlers()) {
h.close(); //must call h.close or a .LCK file will remain.
h.close();//must call h.close or a .LCK file will remain.
}
return 0;
}
......@@ -274,7 +274,8 @@ public class ConverterInstance {
.withArgName("quiet|debug|verbose")
.withDescription(
"Be extra quiet only errors are shown; " + "Show debugging information; "
+ "extra information is given for Verbose; " + "default is warning level").hasArg()
+ "extra information is given for Verbose; " + "default is warning level")
.hasArg()
.create(OptionString.LOGLEVEL.toString()));
options.addOption(OptionBuilder
.withArgName("logfile|'n'|'u'")
......@@ -282,13 +283,15 @@ public class ConverterInstance {
"The filepath where the log file should be created; "
+ "No file will be created when equal to 'n'; "
+ "A unique filename will be created when equal to 'u'; "
+ "default it creates a log called '" + Logger_filepath + "'").hasArg()
+ "default it creates a log called '" + Logger_filepath + "'")
.hasArg()
.create(OptionString.LOGFILE.toString()));
options.addOption(OptionBuilder
.withArgName("folder path")
.withDescription(
"The path to the location that the logs should be placed, "
+ "default it puts the logs in the folder '" + Logger_folderpath + "'").hasArg()
+ "default it puts the logs in the folder '" + Logger_folderpath + "'")
.hasArg()
.create(OptionString.LOGFOLDER.toString()));
options.addOption(OptionString.NOHEADER.toString(), false,
"Does not write the CSV file header to the output log");
......@@ -314,7 +317,8 @@ public class ConverterInstance {
.withArgName("extension")
.withDescription(
"File extention used when searching for SPEC files when the 'bulk' option is used. Default:'"
+ specHelper.specFileExt + "'").hasArg().create(OptionString.SPECEXT.toString()));
+ specHelper.specFileExt + "'")
.hasArg().create(OptionString.SPECEXT.toString()));
// Add Functional Options
options.addOption(OptionString.BULK.toString(), false,
......@@ -345,11 +349,11 @@ public class ConverterInstance {
// Logging Level
logger.setUseParentHandlers(false);
consoleHandler.setFormatter(new MohawkConsoleFormatter());
setLoggerLevel(Level.FINE); // Default Level
setLoggerLevel(Level.FINE);// Default Level
if (cmd.hasOption(OptionString.LOGLEVEL.toString())) {
String loglevel = cmd.getOptionValue(OptionString.LOGLEVEL.toString());
if (loglevel.equalsIgnoreCase("quiet")) {
setLoggerLevel(Level.SEVERE);
setLoggerLevel(Level.WARNING);
} else if (loglevel.equalsIgnoreCase("debug")) {
setLoggerLevel(Level.FINEST);
} else if (loglevel.equalsIgnoreCase("verbose")) {
......@@ -392,7 +396,7 @@ public class ConverterInstance {
Logger_filepath = logfile.getAbsolutePath();
if (WriteCSVFileHeader) {
FileOutputStream writer = new FileOutputStream(logfile, true); // Always append!
FileOutputStream writer = new FileOutputStream(logfile, true);// Always append!
writer.write(MohawkCSVFileFormatter.csvHeaders().getBytes());
writer.flush();
writer.close();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment