Skip to content

Instantly share code, notes, and snippets.

@nraychaudhuri
Created October 10, 2012 19:02
Show Gist options
  • Save nraychaudhuri/3867692 to your computer and use it in GitHub Desktop.
Save nraychaudhuri/3867692 to your computer and use it in GitHub Desktop.
Enable logging for Play test
import play.api._
import play.api.test._
import play.api.test.Helpers._
trait Loggable {
protected def enableLog = {
Logger.configure(
Map("application.home" -> new java.io.File(".").getAbsolutePath),
Map.empty,
Mode.Dev)
}
protected def runningWithLog[T](fakeApp: FakeApplication)(block: => T): T = {
running(fakeApp){
try {
enableLog
block
} finally {
Logger.shutdown()
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment