小编kam*_*951的帖子

Gatling - 如何在 Scala 中设置 gatling 控制台日志级别

我创建了一个 maven 项目,它将生成一个包含我所有模拟的 jar 文件,当我运行它时,控制台日志级别太高。对我来说无用的信息太多了。有没有办法在代码中配置它?这是我的代码:

import io.gatling.app.Gatling
import io.gatling.core.config.GatlingPropertiesBuilder 
import io.gatling.core.config.GatlingConfiguration

object Engine extends App {
    val props = new GatlingPropertiesBuilder
    if(System.getProperty("resultsFolder") == null){
      props.resultsDirectory("results")
    }else{
      props.resultsDirectory(System.getProperty("resultsFolder"))
    }

    props.dataDirectory("data")
      props.simulationClass(System.getProperty("simulationClass"))

    Gatling.fromMap(props.build)
  sys.exit()
}
Run Code Online (Sandbox Code Playgroud)

这是我的目录树:

¦   dependency-reduced-pom.xml
¦   pom.xml
¦
+---src
    +---main
    ¦   +---resources
    ¦   +---scala
    ¦       +---myPackage
    ¦                   ¦   Engine.scala
    ¦                   ¦
    ¦                   +---simulation
    ¦                           BasicSimulation.scala
    ¦
    +---test
        +---resources
        ¦       application.conf
        ¦       gatling.conf
        ¦       logback-test.xml
        ¦
        +---scala
                Placeholder.scala
Run Code Online (Sandbox Code Playgroud)

.config 文件和 logback 是 Gatling 的默认文件。

logging scala jar gatling

5
推荐指数
2
解决办法
5400
查看次数

标签 统计

gatling ×1

jar ×1

logging ×1

scala ×1