在play 2.4 logback配置中,$ {application.home}在哪里定义? [英] in play 2.4 logback configurations, where is ${application.home} defined?

查看:62
本文介绍了在play 2.4 logback配置中,$ {application.home}在哪里定义?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

此处的链接显示了如何配置自定义记录器.

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

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

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

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

推荐答案

如@ user316607所示,Play应该在编译时相关性注入,您需要按照ApplicationLoader中自己调用Logger.configure ="noreferrer">此博客文章:

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

这篇关于在play 2.4 logback配置中,$ {application.home}在哪里定义?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆