I don't see a problem with multiple log4j files -- I like knowing that the logging configuration (really, test configuration) is being sourced from the module I'm working in. This also has the added benefit of separating different log levels for the code we're looking at. e.g. we could reasonable care about DEBUG for Druid tests, but not for Piglet. Or, we might have DEBUG for core, but want WARN for core code in the ElasticSearch module.

As a general rule, I find it extremely confusing when modules "reach out" of themselves and into other modules for configuration.

I will say that if having some reusable test utilities is desired (akin to some "suite" -- configuration, utilities), I think it would be best to create a new Maven module which contains such configuration and include that at the test scope (we would not want to include log4j.properties in that built jar though..). I'm guessing the duplicate log4j.properties are coming from these modules depending on calcite-core's test-jar?

Julian Hyde wrote:
Several components have a log4j.properties file checked into git:

$ git ls-files \*log4j.properties
core/src/test/resources/log4j.properties
druid/src/test/resources/log4j.properties
elasticsearch/src/test/resources/log4j.properties
mongodb/src/test/resources/log4j.properties
piglet/src/test/resources/log4j.properties
splunk/src/test/resources/log4j.properties

Is this helpful? Since only the first file on the classpath is
loaded[1], there's a good chance that the file you modify will have no
effect. Hence several minutes wasted tinkering with ineffective
configs.

I notice that Druid's tests have been sending large amounts of logging
to /tmp/trace.log for months (yup, my fault [2]), and no one has
noticed.

I suggest that we nuke all of the log4j.properties files except
core/src/test/resources/log4j.properties. Of course developers can
create their own xxx/src/test/resources/log4j.properties, but they
just shouldn't commit it to master.

Julian

[1] 
http://stackoverflow.com/questions/10890505/multiple-log4j-properties-files-in-classpath

[2] 
https://github.com/apache/calcite/blob/master/druid/src/test/resources/log4j.properties

Reply via email to