You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jmeter.apache.org by FSchumacher <gi...@git.apache.org> on 2017/02/05 12:38:22 UTC

[GitHub] jmeter pull request #254: Feature/bz60589-1 PR for review (logkit to slf4j /...

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

    https://github.com/apache/jmeter/pull/254#discussion_r99488229
  
    --- 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 --
    
    Why is `id` an `int`, when it is used as a `char` below, only?


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---