Request: Turn on debug logging with command-line flag

Most of the time, I don’t like to have debug logging turned on, because it is a little too verbose.

But when I am in active development and things are going weird, it can be nice to have all that debug information.

Is there already a way to override the .conf file to turn on debug logging, and if not, would you consider it for 2.1?

gatling.conf can’t do anything about logging, logback.xml can.
What’s the difference between editing gatling.conf instead of editing logback.xml?
Then, you know you can use System properties in your logback.xml, right?

I did not know that I can use System Properties in my logback.xml. Can you give me a simple example of that to get me started?

http://logback.qos.ch/faq.html#overrideFromCL

I’m trying to make this work as intended, and I am not having much luck. Here’s what I have:

`

<?xml version="1.0" encoding="UTF-8"?> %d{HH:mm:ss.SSS} [%-5level] %logger{15} - %msg%n%rEx false

`

What I expected was that I would only see the TRACE logs if httpLogging was set to TRACE. Instead, the TRACE logs are displaying unconditionally.

How do I need to tweak this so that it does what I intended?

Loggers are a hierarchy: the one defined for root gets overridden for io.gatling.http.ahc.AsyncHandlerActor.

I get it. By re-commenting out the AsyncHandlerActor, then it honors my setting. Perfect! Thanks! :slight_smile:

Related question:

What do I need to put in my code, instead of “println()” in order to log to the DEBUG level, so that my debug output is only output when the logging level is set to DEBUG or lower?

Gatling uses scala-logging, a nice wrapper on top of slf4j.
Either use it or bare slf4j.

Not sure how to make it work…

The link you sent says it requires Scala 2.11. Gatling ships with Scala 2.10. But that’ can’t be the problem, because…

I looked at the source code of Gatling, e.g. gatling-core/src/main/scala/io/gatling/core/session/Session.scala,
it imports com.typesafe.scalalogging.StrictLogging, and then just extends StrictLogging, exactly like the website you linked to,
but when I do that, I get a compile error:

`
09:37:24.697 [ERROR] i.g.a.ZincCompiler$ - /src/poc/rtde/src/scala/com/cigna/common/SessionManagement.scala:4: object StrictLogging is not a member of package com.typesafe.scalalogging
09:37:24.700 [ERROR] i.g.a.ZincCompiler$ - import com.typesafe.scalalogging.StrictLogging
09:37:24.701 [ERROR] i.g.a.ZincCompiler$ - ^

`

Thoughts?

package changed: https://github.com/gatling/gatling/blob/2.0.X/gatling-core/src/main/scala/io/gatling/core/session/Session.scala#L20