简体   繁体   English

使用Java(不是命令行)启动时覆盖JMeter的默认日志位置

[英]Override default log location for JMeter when launching with Java (not command line)

Is there an equivalent of the -j command-line option when launching JMeter using Java? 使用Java启动JMeter时是否有等效的-j命令行选项?

I'm running a series of test scripts that each need to have a custom log name - normally I'd just define each log location using -j, but in these cases they need to be launched through Java. 我正在运行一系列测试脚本,每个脚本都需要有一个自定义日志名称 - 通常我只是使用-j定义每个日志位置,但在这些情况下,它们需要通过Java启动。

  1. If you have possibility to amend the java code and invoke System.setProperty function : 如果您有可能修改java代码并调用System.setProperty函数:

     System.setProperty("jmeter.logfile", "/desired/path/to/jmeter.log)" 
  2. If you don't: 如果你不这样做:

    • either pass the property via -D command line argument like: 要么通过-D命令行参数传递属性,如:

       java -Djmeter.logfile=/desired/path/to/jmeter.log .... 
    • or add the next line to system.properties file: 或者将下一行添加到system.properties文件中:

       jmeter.logfile=/desired/path/to/jmeter.log 

More information: 更多信息:

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM