Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I am using Maven for my project and have following question:

I want to see the logging output of my JUnit tests (log4j, System.out, whatever) in test reports. Do you have any idea how to achieve this?

Thanks ;-)

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
251 views
Welcome To Ask or Share your Answers For Others

1 Answer

I believe you can redirect the output (System.out) of test using the maven surefire plugin configuration key redirectTestOutputToFile, and then find the output in target/surefire-reports

Check more about this in the plugin docs

In one snipplet:

<build>
  <plugins>
      <plugin>
      <groupId>org.apache.maven.plugins</groupId>
      <artifactId>maven-surefire-plugin</artifactId>
      <configuration>
          <redirectTestOutputToFile>true</redirectTestOutputToFile>
      </configuration>
      </plugin>
  </plugins>
</build>

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share

548k questions

547k answers

4 comments

86.3k users

...