[英]How to get Spec file logs withoug using ActorLogging
我有這樣的測試文件
class SomeSpec extends Specification with Specs2RouteTest with SomeService
在我編寫測試用例的地方,它的工作正常。
但是我無法在日志文件中獲取日志消息,因此我需要登錄該規范,現在我們可以通過使用
class SomeSpec extends Specification with Specs2RouteTest with
SomeService with ActorLogging with Actor
我的問題是我不想在不使用akka.actor.ActorLogging
情況下使用它,我想在日志文件中獲取規格日志,因此您可以提出其他建議嗎?
只需使用非Akaa日志庫(例如Scala Logging)即可 。
它提供了幾個mixin,因此您可以執行以下操作:
class SomeSpec extends Specification with Specs2RouteTest with SomeService with LazyLogging {
logger.debug("This is very convenient ;-)")
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.