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

心已入冬 提交于 2020-01-02 03:20:07

问题


The link here shows you how to configure your custom logger.

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

I was just wondering where is the ${applicaation.home} defined, as it seems to not have been defined in my production environment.


回答1:


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



回答2:


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




回答3:


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.



来源:https://stackoverflow.com/questions/31486216/in-play-2-4-logback-configurations-where-is-application-home-defined

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