0

The stactrace output by the unit test is truncated and not useful because of that. I don't have access to the surefire reports and the majority of the logs are suppressed because of the log level set in the command below. I also can't change the mvn command.

How do I disable stactrace trimming with the current limitations?

Command:

mvn -B -ntp -s settings.xml clean org.jacoco:jacoco-maven-plugin:0.8.7:prepare-agent test org.jacoco:jacoco-maven-plugin:0.8.7:report -Dcheckstyle.skip -Dorg.slf
4j.simpleLogger.defaultLogLevel=warn

Log Output:

[ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.015 s <<< FAILURE! - in ****.controller.RealmAdminControllerTest
[ERROR] test  Time elapsed: 0.013 s  <<< ERROR!
java.lang.NullPointerException
        at ***.controller.RealmAdminControllerTest.test(RealmAdminControllerTest.java:18)

I've tried adding trimStackTrace = false to the surefire & failsafe plugins without any luck (individually and as a group):

            <plugin>
                <groupId>org.jacoco</groupId>
                <artifactId>jacoco-maven-plugin</artifactId>
                <configuration>
                    <append>true</append>
                    <trimStackTrace>false</trimStackTrace>
                </configuration>
                <executions>
                    <execution>
                        <id>default-prepare-agent</id>
                        <goals>
                            <goal>prepare-agent</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>default-report</id>
                        <goals>
                            <goal>prepare-agent-integration</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>jacoco-site</id>
                        <phase>verify</phase>
                        <goals>
                            <goal>report</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-failsafe-plugin</artifactId>
                <configuration>
                    <trimStackTrace>false</trimStackTrace>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-report-plugin</artifactId>
                <configuration>
                    <trimStackTrace>false</trimStackTrace>
                </configuration>
            </plugin>
ScrappyDev
  • 2,307
  • 8
  • 40
  • 60

1 Answers1

0

If you want to see full logs in the console, may also need to set the useFile parameter as well. See this answer.

user944849
  • 14,524
  • 2
  • 61
  • 83
  • I used to see the logs, but they added the `-Dorg.slf4j.simpleLogger.defaultLogLevel=warn` argument, and now I can't. What I need now, is to make the stack trace in the ERROR logs be the full stack trace, not the abreviated one. – ScrappyDev Nov 19 '21 at 16:54