We are using the logging config from here and we want to add scenario id to the pattern.
I was trying to find out the answer in the documentation or on the internet but I didn't find anything about how to pass a variable (some data) from Java to logback-test.xml
In logback-test.xml
we have something like this:
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
And we want to have something like this:
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg - %scenarioId %n</pattern>
I am not aware of any way to do that in log4j / logback. If you don't find anything I say why not print
it in your test and it will show up in the HTML report.
Are you actually using the parallel runner ? Normally you never need to look at logs - because even if you run in parallel, you will get a nice HTML report for each scenario.
EDIT: an idea I haven't tried, if you see the Karate Gatling readme - it mentions how you can pass the karate
object into JS or Java. If you use the ScriptBridge
type, it has a log(...)
method that you may be able to call from Java - which should output to the same logger as the currently executing Scenario
. You may be able to come up with some custom strategy to prefix the scenario-id etc and log from your selenium code.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.