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

浪尽此生 提交于 2019-12-05 07:27:09

As indicated by @user316607, Play should define application.home by itself in the 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:

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 ...
}

I feel stupid. I just realised that it's part of logback and not part of play. You can define your own variables like thus:

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

Checkout link here for more details: http://logback.qos.ch/manual/configuration.html#definingProps

appliation.home is defined by play framework itself.

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

You must have another problem.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!