Skip to content

Commit

Permalink
#119 Quieting down Jersey logging
Browse files Browse the repository at this point in the history
  • Loading branch information
rjrudin committed Aug 4, 2016
1 parent 3cd7636 commit 5879c9d
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 4 deletions.
6 changes: 3 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ buildscript {
}
}
dependencies {
classpath "com.gradle.publish:plugin-publish-plugin:0.9.2"
classpath "com.gradle.publish:plugin-publish-plugin:0.9.5"
}
}

Expand Down Expand Up @@ -81,11 +81,11 @@ pluginBundle {
displayName = 'ml-gradle for MarkLogic'
description = 'Gradle plugin for configuring and deploying applications to MarkLogic'
tags = ['marklogic']
version = "2.3.0"
version = "2.3.1"
}
}

mavenCoordinates {
version = "2.3.0"
version = "2.3.1"
}
}
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
group=com.marklogic
version=2.3.0
version=2.3.1
mlAppDeployerDependency=com.marklogic:ml-app-deployer:2.3.0

18 changes: 18 additions & 0 deletions src/main/groovy/com/marklogic/gradle/MarkLogicPlugin.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package com.marklogic.gradle

import com.marklogic.appdeployer.command.forests.DeployCustomForestsCommand
import com.marklogic.gradle.task.forests.DeployCustomForestsTask
import com.sun.jersey.core.spi.component.ProviderServices
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.slf4j.LoggerFactory
Expand Down Expand Up @@ -114,13 +115,18 @@ import com.marklogic.mgmt.admin.AdminConfig
import com.marklogic.mgmt.admin.AdminManager
import com.marklogic.mgmt.admin.DefaultAdminConfigFactory

import java.util.logging.Level
import java.util.logging.Logger

class MarkLogicPlugin implements Plugin<Project> {

org.slf4j.Logger logger = LoggerFactory.getLogger(getClass())

void apply(Project project) {
logger.info("\nInitializing ml-gradle")

quietDownJerseyLogging()

// Initialize groovysh support first so it doesn't pick up all the properties added when the AppDeployer is initialized
initializeGroovyShellSupport(project)
initializeAppDeployerObjects(project)
Expand Down Expand Up @@ -421,4 +427,16 @@ class MarkLogicPlugin implements Plugin<Project> {
deployer.setCommands(commands)
return deployer
}

/**
* When the MarkLogic DatabaseClient class is used in Gradle, the Jersey ProviderServices class spits out
* a lot of not helpful logging at the INFO level. So we bump it down to WARNING to avoid that.
*/
void quietDownJerseyLogging() {
try {
Logger.getLogger(ProviderServices.class.getName()).setLevel(Level.WARNING)
} catch (Exception e) {
// Ignore, not important
}
}
}

0 comments on commit 5879c9d

Please sign in to comment.