You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@drill.apache.org by "Paul Rogers (JIRA)" <ji...@apache.org> on 2017/02/24 20:56:45 UTC

[jira] [Comment Edited] (DRILL-5114) Rationalize use of Logback logging in unit tests

    [ https://issues.apache.org/jira/browse/DRILL-5114?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15883489#comment-15883489 ] 

Paul Rogers edited comment on DRILL-5114 at 2/24/17 8:56 PM:
-------------------------------------------------------------

Found a simpler solution: simply rename the {{logback.xml}} file in {{test/resources}} to {{logback-test.xml}}, then make the logging less intensive. This prevents verbose logging, but lets specific tests enable more detailed logging when needed using the new {{LogFixture}}.

In debug mode, Logback first looks for {{logback-test.xml}} on the class path. If found, Logback stops there. If not found, it then looks for all instances of {{logback.xml}}. Since we have two (one for test, another for production), Logback complains and dumps a bunch of messages into the log. The version of {{logback.xml}} that is used is undefined.

By renaming the test file, then Logback will prefer that file in tests, we get no unwanted log output, and the config file chosen is deterministic.


was (Author: paul-rogers):
Found a simpler solution: simply rename the {{logback.xml}} file in {{test/resources}} to {{logback-test.xml}}, then make the logging less intensive. This prevents verbose logging, but lets specific tests enable more detailed logging when needed using the new {{LogFixture}}.

> Rationalize use of Logback logging in unit tests
> ------------------------------------------------
>
>                 Key: DRILL-5114
>                 URL: https://issues.apache.org/jira/browse/DRILL-5114
>             Project: Apache Drill
>          Issue Type: Improvement
>    Affects Versions: 1.8.0
>            Reporter: Paul Rogers
>            Assignee: Paul Rogers
>            Priority: Minor
>
> Drill uses Logback as its logger. The logger is used in several to display some test output. Test output is sent to stdout, rather than a log file. Since Drill also uses Logback, that same configuration sends much Drill logging output to stdout as well, cluttering test output.
> Logback requires that that one Logback config file (either logback.xml or hogback-test.xml) exist on the class path. Tests store the config file in the src/test/resources folder of each sub-project.
> These files set the default logging level to debug. While this setting is fine when working with individual tests, the output is overwhelming for bulk test runs.
> The first requested change is to set the default logging level to error.
> The existing config files are usually called "logback.xml." Change the name of test files to "logback-test.xml" to make clear that they are, in fact, test configs.
> The {{exec/java-exec/src/test/resources/logback.xml}} config file is a full version of Drill's production config file. Replace this with a config suitable for testing (that is, the same as other modules.)
> The java-exec project includes a production-like config file in its non-test sources: {{exec/java-exec/src/main/resources/logback.xml}}. Remove this as it is not needed. (Instead, rely on the one shipped in the distribution subsystem, which is the one copied to the Drill distribution.)
> Since Logback complains bitterly (via many log messages) when it cannot find a configuration file (and each sub-module must have its own test configuration), add missing logging configuration files:
> * exec/memory/base/src/test/resources/logback-test.xml
> * logical/src/test/resources/logback-test.xml



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)