Skip to content

Commit

Permalink
Merge pull request #104 from nebula-plugins/configurable-logging-via-…
Browse files Browse the repository at this point in the history
…env-variables

configure logging via env variables
  • Loading branch information
rpalcolea authored Dec 12, 2018
2 parents f3fe2ad + 825fee0 commit 09d9233
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/main/groovy/nebula/test/BaseIntegrationSpec.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ abstract class BaseIntegrationSpec extends Specification {
protected LogLevel logLevel = LogLevel.LIFECYCLE
protected List<File> initScripts = []

private static final LOGGING_LEVEL_ENV_VARIABLE = "NEBULA_TEST_LOGGING_LEVEL"

def setup() {
projectDir = new File("build/nebulatest/${this.class.canonicalName}/${testName.methodName.replaceAll(/\W+/, '-')}").absoluteFile
if (projectDir.exists()) {
Expand All @@ -44,7 +46,11 @@ abstract class BaseIntegrationSpec extends Specification {
* @return
*/
protected LogLevel getLogLevel() {
return logLevel
String levelFromEnv = System.getenv(LOGGING_LEVEL_ENV_VARIABLE)
if(!levelFromEnv) {
return logLevel
}
return LogLevel.valueOf(levelFromEnv.toUpperCase())
}

/* Setup */
Expand Down

0 comments on commit 09d9233

Please sign in to comment.