My end goal is to be able to do a better job of managing output from my test classes. The current strategy is to pass along the log level passed on the gradle command line to into the jvm arguments as part of the test closure. From there our testng classes will pick up on the system property that was set and dynamically set the log level before the tests run. However, my current problem is that when I try to get the log level back i get a null value. Any thoughts?
Current Setup - Parent Project Build File ------------------------------------------------------------------
subprojects{
test{
jvmArgs '-Xmx512m', '-XX:MaxPermSize=256m', "-DlogLevel=${logging.level}"
us
}
}
Gradle build time: Monday, February 20, 2012 4:00:18 PM UTC Groovy: 1.8.4 Ant: Apache Ant™ version 1.8.2 compiled on December 20 2010 Ivy: 2.2.0 JVM: 1.6.0_27 (Sun Microsystems Inc. 20.2-b06) OS: Windows 7 6.1 amd64
The current behavior is that ‘task.logging.level’ only returns a non-null value if the logging level is explicitly set for that task. (I think there is an open issue that per-task log levels don’t work as intended.) Otherwise, the logging level is inherited from the containing project. ‘gradle.startParameter.logLevel’ is the log level requested on the command line, and may be all you need.