【问题标题】:How to get Spec file logs withoug using ActorLogging如何在不使用 Actor Logging 的情况下获取 Spec 文件日志
【发布时间】:2016-02-12 15:21:56
【问题描述】:

我有这样的测试文件

class SomeSpec extends Specification with Specs2RouteTest with SomeService

我写过测试用例的地方,它工作得很好。

但我无法在日志文件中获取日志消息,所以我需要登录该规范,现在我们可以通过使用来做到这一点

class SomeSpec extends Specification with Specs2RouteTest with 
SomeService with ActorLogging with Actor 

我的问题是我不想在不使用akka.actor.ActorLogging的情况下使用它,我想在日志文件中获取规格日志,所以你能建议一些其他方法吗?

【问题讨论】:

    标签: scala akka spray specs2 specs


    【解决方案1】:

    只需使用非 Akaa 日志库,例如 Scala Logging

    它提供了几个 mixin,因此您可以执行以下操作:

    class SomeSpec extends Specification with Specs2RouteTest with SomeService with LazyLogging {
      logger.debug("This is very convenient ;-)")
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-06-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多