From 4a23f679bdd50402788fb0a12e252afc44610a00 Mon Sep 17 00:00:00 2001 From: Chris Rebert Date: Mon, 9 Mar 2015 00:39:19 -0700 Subject: Add squelch-invalid-http-logging config option --- src/main/resources/application.conf | 1 + src/main/scala/com/getbootstrap/savage/server/Boot.scala | 11 +++++++++++ src/main/scala/com/getbootstrap/savage/server/Settings.scala | 1 + 3 files changed, 13 insertions(+) (limited to 'src') diff --git a/src/main/resources/application.conf b/src/main/resources/application.conf index 869f640..4ea734d 100644 --- a/src/main/resources/application.conf +++ b/src/main/resources/application.conf @@ -22,6 +22,7 @@ spray.can { savage { default-port = 6060 + squelch-invalid-http-logging = true github-repo-to-watch = "twbs/bootstrap" github-test-repo = "twbs-savage/bootstrap" ignore-branches-from-watched-repo = true diff --git a/src/main/scala/com/getbootstrap/savage/server/Boot.scala b/src/main/scala/com/getbootstrap/savage/server/Boot.scala index bcd3a9e..2448deb 100644 --- a/src/main/scala/com/getbootstrap/savage/server/Boot.scala +++ b/src/main/scala/com/getbootstrap/savage/server/Boot.scala @@ -29,11 +29,22 @@ object Boot extends App { run(argsPort) + def squelchInvalidHttpLogging() { + import org.slf4j.LoggerFactory + import ch.qos.logback.classic.{Logger,Level} + + LoggerFactory.getLogger("spray.can.server.HttpServerConnection").asInstanceOf[Logger].setLevel(Level.ERROR) + } + def run(port: Option[Int]) { implicit val system = ActorSystem("on-spray-can") val settings = Settings(system) // import actorSystem.dispatcher + if (settings.SquelchInvalidHttpLogging) { + squelchInvalidHttpLogging() + } + val deleter = system.actorOf(SmallestMailboxPool(3).props(Props(classOf[BranchDeleter])), "branch-deleters") val statusSetters = system.actorOf(SmallestMailboxPool(3).props(Props(classOf[CommitStatusSetter])), "status-setters") val commenter = system.actorOf(SmallestMailboxPool(3).props(Props(classOf[PullRequestCommenter])), "gh-pr-commenters") diff --git a/src/main/scala/com/getbootstrap/savage/server/Settings.scala b/src/main/scala/com/getbootstrap/savage/server/Settings.scala index f647557..d8caf55 100644 --- a/src/main/scala/com/getbootstrap/savage/server/Settings.scala +++ b/src/main/scala/com/getbootstrap/savage/server/Settings.scala @@ -19,6 +19,7 @@ class SettingsImpl(config: Config) extends Extension { val GitHubWebHookSecretKey: ByteString = ByteString(config.getString("savage.github-web-hook-secret-key").utf8Bytes) val TravisToken: String = config.getString("savage.travis-token") val DefaultPort: Int = config.getInt("savage.default-port") + val SquelchInvalidHttpLogging: Boolean = config.getBoolean("savage.squelch-invalid-http-logging") val Whitelist: FilePathWhitelist = new FilePathWhitelist(config.getStringList("savage.whitelist").asScala) val Watchlist: FilePathWatchlist = new FilePathWatchlist(config.getStringList("savage.file-watchlist").asScala) val BranchPrefix: String = config.getString("savage.branch-prefix") -- cgit v1.2.3