Changeset 396


Ignore:
Timestamp:
03/08/12 10:10:42 (12 years ago)
Author:
sherbold
Message:
  • added application parameter log4j with possible values enable/disable (default: enable) that determines if a log4j logger is active during the execution
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/Runner.java

    r299 r396  
    3030                text, swt 
    3131        }; 
     32         
     33        public enum LOG4JTYPE { 
     34                enable, disable 
     35        } 
    3236 
    3337        /** 
     
    5256                CommandExecuter.getInstance().addCommandPackage( 
    5357                                "de.ugoe.cs.eventbench.jfc.commands"); 
    54                 new Log4JLogger(); 
     58                //new Log4JLogger(); 
    5559 
    5660                OptionParser parser = new OptionParser(); 
     61                OptionSpec<LOG4JTYPE> log4j = parser.accepts("log4j", "Allowed values: enable, disable").withRequiredArg() 
     62                                .ofType(LOG4JTYPE.class).defaultsTo(LOG4JTYPE.enable); 
    5763                OptionSpec<UITYPE> ui = parser.accepts("ui", "Allowed values: text, swt").withRequiredArg() 
    5864                                .ofType(UITYPE.class).defaultsTo(UITYPE.text); 
     
    6167                List<String> startupCommands = options.nonOptionArguments(); 
    6268                try { 
    63                 switch (options.valueOf(ui)) { 
    64                 case text: 
    65                         TextConsole textConsole = new TextConsole(); 
    66                         for (String command : startupCommands) { 
    67                                 CommandExecuter.getInstance().exec(command); 
     69                        switch (options.valueOf(log4j)) { 
     70                        case enable: 
     71                                new Log4JLogger(); 
     72                                break; 
     73                        case disable: 
     74                                // do nothing 
     75                                break; 
     76                        default: 
     77                                throw new AssertionError("reached source code that should be unreachable impossible"); 
    6878                        } 
    69                         textConsole.run(true); 
    70                         break; 
    71                 case swt: 
    72                         MainWindow mainWindow = new MainWindow(startupCommands); 
    73                         mainWindow.open(); 
    74                         break; 
    75                 } 
     79                         
     80                        switch (options.valueOf(ui)) { 
     81                        case text: 
     82                                TextConsole textConsole = new TextConsole(); 
     83                                for (String command : startupCommands) { 
     84                                        CommandExecuter.getInstance().exec(command); 
     85                                } 
     86                                textConsole.run(true); 
     87                                break; 
     88                        case swt: 
     89                                MainWindow mainWindow = new MainWindow(startupCommands); 
     90                                mainWindow.open(); 
     91                                break; 
     92                        default: 
     93                                throw new AssertionError("reached source code that should be unreachable impossible"); 
     94                        } 
    7695                } catch (OptionException e) { 
    7796                        System.err.println("Invalid Parameters: " + e.getMessage()); 
Note: See TracChangeset for help on using the changeset viewer.