Github user woonsan commented on a diff in the pull request:

    https://github.com/apache/jmeter/pull/254#discussion_r99694350
  
    --- Diff: src/core/org/apache/jmeter/NewDriver.java ---
    @@ -276,4 +276,106 @@ private static String 
exceptionsToString(List<Exception> exceptionsInInit) {
             }
             return builder.toString();
         }
    +
    +    /*
    +     * Set logging related system properties.
    +     */
    +    private static void setLoggingProperties(String[] args) {
    +        String jmLogFile = getCommandLineArgument(args, (int) 'j', 
"jmeterlogfile");// $NON-NLS-1$ $NON-NLS-2$
    +
    +        if (jmLogFile != null && !jmLogFile.isEmpty()) {
    +            jmLogFile = replaceDateFormatInFileName(jmLogFile);
    +            System.setProperty("jmeter.logfile", jmLogFile);// $NON-NLS-1$
    +        } else if (System.getProperty("jmeter.logfile") == null) {// 
$NON-NLS-1$
    +            System.setProperty("jmeter.logfile", "jmeter.log");// 
$NON-NLS-1$ $NON-NLS-2$
    +        }
    +
    +        String jmLogConf = getCommandLineArgument(args, (int) 'i', 
"jmeterlogconf");// $NON-NLS-1$ $NON-NLS-2$
    +        File logConfFile = null;
    +
    +        if (jmLogConf != null && !jmLogConf.isEmpty()) {
    +            logConfFile = new File(jmLogConf);
    +        } else if (System.getProperty("log4j.configurationFile") == null) 
{// $NON-NLS-1$
    +            logConfFile = new File("log4j2.xml");// $NON-NLS-1$
    +            if (!logConfFile.isFile()) {
    +                logConfFile = new File(JMETER_INSTALLATION_DIRECTORY, 
"bin" + File.separator + "log4j2.xml");// $NON-NLS-1$ $NON-NLS-2$
    +            }
    +        }
    +
    +        if (logConfFile != null) {
    +            System.setProperty("log4j.configurationFile", 
logConfFile.toURI().toString());// $NON-NLS-1$
    +        }
    +    }
    +
    +    /*
    +     * Find command line argument option value by the id and name.
    +     */
    +    private static String getCommandLineArgument(String [] args, int id, 
String name) {
    --- End diff --
    
    I simply used the same pattern as the Avalon CLOptionDescriptor (using the 
id as integer for some reason) usages in JMeter.java, hoping for better 
improvement (merging command line args handling in both location somehow) in 
the future. At the moment, it's not easy because the class loader contexts are 
different between NewDriver's and JMeter's.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to