From 69945d9425a75f2c55e9eb477300ab6215cb23af Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=BCrgen=20Walter?= <juergen.walter@uni-wuerzburg.de>
Date: Tue, 24 Jan 2017 16:18:52 +0100
Subject: [PATCH] improvements to console

---
 .../descartes/pmx/console/PMXCommandLine.java | 27 +++++++++++--------
 1 file changed, 16 insertions(+), 11 deletions(-)

diff --git a/tools.descartes.pmx.console/src/tools/descartes/pmx/console/PMXCommandLine.java b/tools.descartes.pmx.console/src/tools/descartes/pmx/console/PMXCommandLine.java
index 488ea1b0..462a3d6e 100644
--- a/tools.descartes.pmx.console/src/tools/descartes/pmx/console/PMXCommandLine.java
+++ b/tools.descartes.pmx.console/src/tools/descartes/pmx/console/PMXCommandLine.java
@@ -66,7 +66,7 @@ public class PMXCommandLine {
 	private static final String CMD_LONG_OPT_INPUT_DIR = "trace-file";
 	private static final String CMD_LONG_OPT_CONFIG_FILE = "pmx-config";
 	private static final String CMD_LONG_OPT_OUTPUT_DIR = "output-dir";
-	private static final String CMD_OPT_NUM_CORE = "numCore";
+	private static final String CMD_OPT_NUM_CORE = "cores";
 
 	private static final HelpFormatter commandLineFormatter = new HelpFormatter();
 	private static final String toolName = "Performance Model eXtractor(PMX)";
@@ -122,13 +122,13 @@ public class PMXCommandLine {
 		Option ignoreAfterOption = OptionBuilder.create("a");
 		options.addOption(ignoreAfterOption);
 
-		OptionBuilder.withArgName("long");
-		OptionBuilder.hasArgs();
+		OptionBuilder.withArgName("cores");
+		OptionBuilder.hasArg();
 		OptionBuilder.withLongOpt(PMXCommandLine.CMD_OPT_NUM_CORE);
 		OptionBuilder.isRequired(false);
-		OptionBuilder.withDescription("specifies number of cores for a host");
+		OptionBuilder.withDescription("specifies number of CPU cores for hosts");
 		OptionBuilder.withValueSeparator(' ');
-		Option numCoresOption = OptionBuilder.create("cores");
+		Option numCoresOption = OptionBuilder.create("n");
 		options.addOption(numCoresOption);
 	}
 	
@@ -166,7 +166,7 @@ public class PMXCommandLine {
 				//--help is no error even if the required file path is missing
 			}else{
 				log.info("Error parsing arguments:"+s);
-				log.info(e.getMessage());
+				// log.info(e.getMessage());
 			}
 			PMXCommandLine.printUsage();
 		}
@@ -198,11 +198,16 @@ public class PMXCommandLine {
 			return controller;
 		} catch (NullPointerException e) {
 			//PMXCommandLine.printUsage();
-			log.info(e);
+			log.info("Nullpointer in class " + e.getStackTrace()[0].getClass() + ", method "
+					+ e.getStackTrace()[0].getMethodName()
+					+ ", Line "
+					+ e.getStackTrace()[0].getLineNumber());
 		} catch (IllegalArgumentException e) {
-			log.info(e);
+			log.info("IllegalArgumentException in class " + e.getStackTrace()[0].getClass() + ", method "
+					+ e.getStackTrace()[0].getMethodName() + ", Line " + e.getStackTrace()[0].getLineNumber());
 		} catch (IOException e) {
-			log.info(e);
+			log.info("IOException in class " + e.getStackTrace()[0].getClass() + ", method "
+					+ e.getStackTrace()[0].getMethodName() + ", Line " + e.getStackTrace()[0].getLineNumber());
 		}
 		return null;
 
@@ -284,7 +289,7 @@ public class PMXCommandLine {
 			ConsoleAppender consoleAppender = new ConsoleAppender(simpleLayout);
 			BasicConfigurator.configure(consoleAppender);
 		} catch (Exception ex) {
-			log.error(ex);
+			log.error("Error during inialization of logging");
 		}
 	}
 
@@ -296,7 +301,7 @@ public class PMXCommandLine {
 			FileAppender fileAppender = new FileAppender(layout, logFileName, false);
 			BasicConfigurator.configure(fileAppender);
 		} catch (Exception ex) {
-			log.error(ex);
+			log.error("Error during inialization of logging");
 		}
 	}
 	
-- 
GitLab