diff options
author | Timothy Farkas <timothyfarkas@apache.org> | 2018-06-25 13:50:37 -0700 |
---|---|---|
committer | Ben-Zvi <bben-zvi@mapr.com> | 2018-07-18 19:15:02 -0700 |
commit | 2c92ea22d9aa098cf3aaaf7893bd2fc33a08af31 (patch) | |
tree | aa01c1a98ec7ea91ca01be155d2e68fbba18ccb0 /docs/dev | |
parent | 6bb0879ea22c31acc42632147ac3a1af9ec66fce (diff) |
DRILL-6496: Added print methods for debugging tests, and fixed missing log statement in VectorUtils.
closes #1336
Diffstat (limited to 'docs/dev')
-rw-r--r-- | docs/dev/TestLogging.md | 37 | ||||
-rw-r--r-- | docs/dev/Testing.md | 1 |
2 files changed, 37 insertions, 1 deletions
diff --git a/docs/dev/TestLogging.md b/docs/dev/TestLogging.md index b87adb10b..59fec543b 100644 --- a/docs/dev/TestLogging.md +++ b/docs/dev/TestLogging.md @@ -103,3 +103,40 @@ Then, if for some reason you want to see the Logback logging, add the following -Dlogback.statusListenerClass=ch.qos.logback.core.status.OnConsoleStatusListener ``` The launch configuration option overrides (appears on the Java command line after) the global setting. + +## Test Logging Configurations + +### Default Test Log Levels + +There is a global `logback-test.xml` configuration file in [common/src/test/resources/logback-test.xml](../../common/src/test/resources/logback-test.xml). This +logging configuration by default outputs error level logs to stdout. + +Debug level logging to lilith can be turned on by adding `-Ddrill.lilith.enable=true` to the command used to run tests. + +### Changing Test Log Levels + +Often times it is most convenient to output logs to the console for debugging. This is best done programatically +by using the [LogFixture](../../exec/java-exec/src/test/java/org/apache/drill/test/LogFixture.java). The [LogFixture](../../exec/java-exec/src/test/java/org/apache/drill/test/LogFixture.java) +allows temporarily changing log levels for blocks of code programatically for debugging. An example of doing this is +the following. + +``` + try(LogFixture logFixture = new LogFixture.LogFixtureBuilder() + .logger(MyClass.class, Level.INFO) + .toConsole() // This redirects output to stdout + .build()) { + // Code block with different log levels. + } +``` + +More details on how to use the [LogFixture](../../exec/java-exec/src/test/java/org/apache/drill/test/LogFixture.java) can be found +int the javadocs for the class. Additionally, there are several methods that allow printing of query results to the console for debugging: + + * BaseTestQuery.printResult + * QueryTestUtil.testRunAndPrint + * QueryBuilder.print + * ClusterTest.runAndPrint + * ClientFixture.runQueriesAndPrint + +**IMPORTANT NOTE:** The methods described above along with LogFixtureBuilder.toConsole() should only be used for debugging. Code +that uses these methods should not be committed, since it produces excess logging on our build servers. diff --git a/docs/dev/Testing.md b/docs/dev/Testing.md index 09343d656..148c7b10a 100644 --- a/docs/dev/Testing.md +++ b/docs/dev/Testing.md @@ -149,7 +149,6 @@ Drill uses the [Maven Surefire plugin](http://maven.apache.org/components/surefi -Ddrill.exec.sys.store.provider.local.write=false -Dorg.apache.drill.exec.server.Drillbit.system_options=\ "org.apache.drill.exec.compile.ClassTransformer.scalar_replacement=on" - -Ddrill.test.query.printing.silent=true -Ddrill.catastrophic_to_standard_out=true -XX:MaxPermSize=512M -XX:MaxDirectMemorySize=3072M -Djava.net.preferIPv4Stack=true |