Gradle-built Generic Java Application Test Logging: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
No edit summary
Line 8: Line 8:
When building with Gradle a generic Java application, stdout and stderr of the tests being executed will be shown at the console if the following are configured:
When building with Gradle a generic Java application, stdout and stderr of the tests being executed will be shown at the console if the following are configured:
* Set <tt>testLogging.showStandardStreams</tt> of the Java plugin Test task, as shown here: [[Testing_with_Gradle_Java_Plugin#Show_stdout_and_stderr_of_the_Test_JVM_on_the_Console|Show stdout and stderr of the Test JVM on the Console]].
* Set <tt>testLogging.showStandardStreams</tt> of the Java plugin Test task, as shown here: [[Testing_with_Gradle_Java_Plugin#Show_stdout_and_stderr_of_the_Test_JVM_on_the_Console|Show stdout and stderr of the Test JVM on the Console]].
* Make sure that a slf4j binding is in the test classpath. Spring uses Logback by default, so the following will work: [[Slf4j#Logback_Binding|Place Logback Binding on test classpath]].
* Make sure that a log4j slf4j binding is in the test classpath. Spring uses Logback by default, so the following will work: [[Slf4j#Logback_Binding|Place Logback Binding on test classpath]].
* Place a [[Logback.xml#Example|logback.xml]] configuration in src/test/resources. At the time of the writing, I was not able to figure out why logging configuration from src/test/resources/application.yml did not work.
* Place a [[Simple_log4j.xml_Example|log4j.xml]] configuration in src/test/resources.

Revision as of 05:58, 7 April 2019

Internal

Overview

When building with Gradle a generic Java application, stdout and stderr of the tests being executed will be shown at the console if the following are configured: