播放框架2.5记录“?"问号而不是行号 [英] Play framework 2.5 logs `?` question marks instead of line numbers

查看:58
本文介绍了播放框架2.5记录“?"问号而不是行号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个具有所有标准配置的Play框架应用.我这样修改 logback.xml :

I have a play framework app with all standard configurations. I modify logback.xml like this:

<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
    <encoder>
        <pattern>%coloredLevel %logger{15} %L - %message%n%xException{10} </pattern>
    </encoder>
</appender>

我尝试将%line %class 等放在其中,而不是将%L 放到那里-都得到相同的结果,它输出<日志消息中的code>?,如下所示:

I tried instead of %L put there %line, %class, etc. - all to the same result, it outputs ? in the log message, like this:

[info] application ? - Checking cart...

我还尝试遵循对此问题的公认答案:Scala Play 框架:用于显示文件和行的记录器模式
并将 val logger = Logger(this.getClass)放在我的课程中.还是一样的结果.有什么办法可以解决?在build.sbt中指定的Logback版本为 2.11 .

I also tried to follow the accepted answer to this question: Scala Play framework: logger pattern for displaying file and line
and put val logger = Logger(this.getClass) inside my class. Still same result. Is there any way to fix it? Logback version specified in build.sbt is 2.11.

推荐答案

我添加 includeCallerData 并工作

   <appender  name="ASYNCSTDOUT" class="ch.qos.logback.classic.AsyncAppender">
        <appender-ref ref="STDOUT"/>
        <includeCallerData>true</includeCallerData>
    </appender>

这篇关于播放框架2.5记录“?"问号而不是行号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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