Jacoco Not covering log4j2 logs having second argument as Supplier

Viewed 19

I am running Jacoco report over a spring boot project with gradle. I am using log4j2 for logging. Also, I am using lombok's "@Log4j2" annotation over the class.

With normal logging eg:

log.debug("This is a debug statement having id: {}", id);

Jacoco does cover this debug statement in the report.

However, with the following example, jacoco report does not cover lambda expression present in the statement.

log.debug("This is a debug statement having id: {}", ()->id)

Jacoco report shows green (code covered) up till first argument, but for second argument it shows red ("()-> id", code not covered).

This causes less coverage in the report. Can this be because of lazy evaluation? Can anyone please help me in fixing this?

Note: log level is set to debug in log4j2.xml file Also, I have tried adding the flag "lombok.addLombokGeneratedAnnotation = true" in lombok.config file.

0 Answers
Related