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