Commit 715d2cca authored by Jonathan Shahen's avatar Jonathan Shahen

Comments; hiding debugging messages in IF statements; adding more logging...

Comments; hiding debugging messages in IF statements; adding more logging levels; Outputting the TIMEOUT each time (I think this isn't working)
parent 036dcb6e
Pipeline #7933 skipped
......@@ -141,10 +141,8 @@ public class MohawkInstance {
// Add Logging Level Options
options.addOption(OptionBuilder
.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")
.withArgName("quiet|warning|info|fine|debug")
.withDescription("default is info level")
.hasArg()
.create(OptionString.LOGLEVEL.toString()));
......@@ -370,15 +368,19 @@ public class MohawkInstance {
// Logging Level
logger.setUseParentHandlers(false);
consoleHandler.setFormatter(new MohawkConsoleFormatter());
setLoggerLevel(Level.FINEST);// Default Level
setLoggerLevel(Level.INFO);// Default Level
if (cmd.hasOption(OptionString.LOGLEVEL.toString())) {
String loglevel = cmd.getOptionValue(OptionString.LOGLEVEL.toString());
if (loglevel.equalsIgnoreCase("quiet")) {
setLoggerLevel(Level.SEVERE);
} else if (loglevel.equalsIgnoreCase("warning")) {
setLoggerLevel(Level.WARNING);
} else if (loglevel.equalsIgnoreCase("info")) {
setLoggerLevel(Level.INFO);
} else if (loglevel.equalsIgnoreCase("debug")) {
setLoggerLevel(Level.FINEST);
} else if (loglevel.equalsIgnoreCase("verbose")) {
setLoggerLevel(Level.INFO);
} else if (loglevel.equalsIgnoreCase("fine")) {
setLoggerLevel(Level.FINE);
}
}
......
......@@ -22,7 +22,7 @@ public class RemoveUnsetRoles {
private Map<String, Vector<CREntry>> mCR;
// user name -> list of roles using their index
private Map<String, Vector<Integer>> mUA;
private boolean debugMsg = true;
private boolean debugMsg = false;
public RemoveUnsetRoles(RBACInstance in, MohawkTiming timing, String timingPrefix) {
inst = in;
......@@ -114,11 +114,13 @@ public class RemoveUnsetRoles {
/* timing */timing.stopTimer(timerKey);
RBACInstance bb = new RBACInstance(vRoles, inst.getUsers(), inst.getAdmin(), mUA, mCR, mCA, inst.getSpec());
try {
WriteRBACSpec writer = new WriteRBACSpec();
writer.Write2File(bb, "logs/testingRemoveUnsetRoles.mohawk");
} catch (IOException e1) {
e1.printStackTrace();
if (debugMsg == true) {
try {
WriteRBACSpec writer = new WriteRBACSpec();
writer.Write2File(bb, "logs/testingRemoveUnsetRoles.mohawk");
} catch (IOException e1) {
e1.printStackTrace();
}
}
return bb;
......
......@@ -41,7 +41,7 @@ public class MohawkSettings {
public TestingResult lastResult;
// SMV
public Long TIMEOUT_SECONDS = (long) 0;// Default infinite
public Long TIMEOUT_SECONDS = (long) 0;// Default 0 (infinite)
public boolean bulk = false;
public Boolean smvDeleteFile = false;
......@@ -94,6 +94,7 @@ public class MohawkSettings {
s.append("sliceRBAC: ").append(sliceRBAC).append("; ");
s.append("sliceRBACQuery: ").append(sliceRBACQuery).append("; ");
s.append("skipRefine: ").append(skipRefine).append("; ");
s.append("removeUnsetRolesRBAC: ").append(removeUnsetRolesRBAC).append("; ");
s.append("NuSMV_filepath: ").append(NuSMV_filepath);
s.append("}");
......
......@@ -247,8 +247,10 @@ public class TestingSuite {
/* TIMING */settings.timing.startTimer(timerName + " (TestRunner)");
if (settings.TIMEOUT_SECONDS == 0) {
logger.info("[OPTION] Disabling the TIMEOUT feature");
settings.lastResult = future.get();
} else {
logger.info("[OPTION] Setting TIMEOUT to " + settings.TIMEOUT_SECONDS + " seconds");
settings.lastResult = future.get(settings.TIMEOUT_SECONDS, TimeUnit.SECONDS);
}
/* TIMING */settings.timing.stopTimer(timerName + " (TestRunner)");
......
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