Custom logger

I’m trying to log values from my server to a file using logback and only getting an empty file (it’s being created, but nothing gets written to it). This is my scenario code:

val myLogger = org.slf4j.LoggerFactory.getLogger(“myLogger”)

val scn = scenario(“LoginScenario”)

.exec(
chain1
)
.exec(session => {

myLogger.info(session(“userID”).as[String])

session

})

And this is the appender in logback.xml:

/home/user/gatling2/results/myLogs/IDs.log %d{HH:mm:ss.SSS} - %msg false

What I have was pieced together from a couple of different (old) posts on here, so I’m not sure what I might be missing or what could be outdated. Any ideas as to what’s going wrong?

Is info level enabled for your logger? As immediate flush is disabled (which is good from a perf pov), do you have enough log records so that the buffer gets flushed?

Number of records was a good catch - I had to temporarily turn on immediateFlush. I also hadn’t configured a logger - adding this to logback.xml worked:

(I also changed my appender name to “myAppender” to avoid confusion/conflicts.)

Thanks for your help!

You’re welcome :slight_smile: