在 play 2.4 logback 配置中, ${application.home} 定义在哪里?

in play 2.4 logback configurations, where is ${application.home} defined?

此处的 link 向您展示了如何配置自定义记录器。

https://www.playframework.com/documentation/2.4.x/SettingsLogger

我只是想知道 ${applicaation.home} 在哪里定义的,因为它似乎没有在我的生产环境中定义。

我觉得自己很蠢。我刚刚意识到它是 logback 的一部分而不是游戏的一部分。您可以像这样定义自己的变量:

<property name="USER_HOME" value="/home/sebastien" />

在此处查看 link 了解更多详情: http://logback.qos.ch/manual/configuration.html#definingProps

appliation.home由play framework自己定义。

https://github.com/playframework/playframework/blob/2.4.x/framework/src/play/src/main/scala/play/api/Logger.scala#L199

你肯定还有问题。

如@user316607 所述,Play 应在 Logger.configure method. If you are seeing the value application.home_IS_UNDEFINED instead, and you're using compile-time dependency injection, you'll need to call Logger.configure yourself in your ApplicationLoader as explained in this blog post:

中自行定义 application.home
class MyApplicationLoader extends ApplicationLoader {
  def load(context: Context) = {
    new MyComponents(context).application
  }
}

class MyComponents(context: Context) extends BuiltInComponentsFromContext(context) {
  // You have to call Logger.configure manually or logback won't work
  Logger.configure(context.environment)

  // ... The rest of your app initialization code ...
}