Commit c61a3946 authored by Benedikt Kleinmeier's avatar Benedikt Kleinmeier
Browse files

In "", added flag "--logname" to command line parser.

- This file creates a new log appender (instead of redirecting the old ones).
- Therefore, it makes it robust against changes in corresponding "" files.

Fix #164
parent c6741320
......@@ -56,7 +56,14 @@ public class VadereConsole {
.action(new SetLogLevelCommand())
.help("Set Log Level for vadere.");
.help("Set Log Level.");
.action(new SetLogNameCommand())
.help("Write log to given file.");
private static void addSubCommandsToParser(ArgumentParser parser) {
......@@ -74,12 +81,12 @@ public class VadereConsole {
.help("Path to project directory");
.help("Path to project directory.");
projectRun.addArgument("--scenario-file", "-f")
.help("Name of Scenario file");
.help("Name of Scenario file.");
......@@ -91,7 +98,7 @@ public class VadereConsole {
// Run Scenario
Subparser scenarioRun = subparsers
.help("Run scenario without a project")
.help("Run scenario without a project.")
.setDefault("func", new ScenarioRunSubCommand());
scenarioRun.addArgument("--output-dir", "-o")
......@@ -110,7 +117,7 @@ public class VadereConsole {
.help("Scenario file to run");
.help("Scenario file to run.");
......@@ -136,7 +143,7 @@ public class VadereConsole {
.help("Scenario files to run");
.help("Scenario files to run.");
// Run Migration Assistant
......@@ -176,7 +183,7 @@ public class VadereConsole {
.help("If set vadere will search for a <scenario-file>.legacy and will replace the current version with this backup." +
" The Backup must be in the same directory");
" The Backup must be in the same directory.");
migrationAssistant.addArgument("--recursive", "-r")
......@@ -184,7 +191,7 @@ public class VadereConsole {
.help("If PATH contains a directory instead of a scenario file recursively search " +
"the directory tree for scenario files and apply the command");
"the directory tree for scenario files and apply the command.");
......@@ -192,7 +199,7 @@ public class VadereConsole {
.help("Create new transformation and identity file based on current latest version" +
"PATH must point to the directory containing the old transformation files." +
" This Argument takes the new Version Label as input");
" This Argument takes the new Version Label as input.");
package org.vadere.simulator.entrypoints.cmd.commands;
import net.sourceforge.argparse4j.inf.Argument;
import net.sourceforge.argparse4j.inf.ArgumentAction;
import net.sourceforge.argparse4j.inf.ArgumentParser;
import net.sourceforge.argparse4j.inf.ArgumentParserException;
import org.apache.log4j.*;
import java.util.Map;
public class SetLogNameCommand implements ArgumentAction {
public void run(ArgumentParser parser, Argument arg, Map<String, Object> attrs, String flag, Object value) throws ArgumentParserException {
String filename = (String) value;
RollingFileAppender appender = new RollingFileAppender();
appender.setLayout(new PatternLayout("%d{ABSOLUTE} %5p [%t] %c{1}:%L - %m%n"));
public void onAttach(Argument arg) {
public boolean consumeArgument() {
return true;
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