简体   繁体   English

应用程序启动后,Playframework退出日志记录,但可用于Global.onStart()

[英]Playframework quit logging after application starts, but works for Global.onStart()

I wrote a play 2.2.1 application and I have problems with logging. 我编写了一个play 2.2.1应用程序,但日志记录出现问题。 I defined a logger per class in this way: 我以这种方式为每个班级定义了一个记录器:

import org.slf4j.LoggerFactory;
import org.slf4j.Logger;

public class Foo extends Controller {
     private static Logger logger = LoggerFactory.getLogger(Foo.class);

     public Result bar(){
        logger.info("Bar called");
        .
        .
        .

     }

}

I am not using a logger.xml . 我没有使用logger.xml Everything perfectly works in dev mode and every class logs fine. 一切都可以在dev模式下完美运行,并且每个类都可以正常记录。 When I run in dist mode, it stops logging after the application is started. 当我在dist模式下运行时,启动应用程序后它将停止记录。 Any idea about what I am doing wrong or what else could I check? 关于我做错了什么或我还能检查什么的任何想法? Thanks in advance! 提前致谢!

我将检查日志级别,可能尝试尝试在conf中显式设置它:logger = DEBUG

I managed to have the logger running adding a logger.xml file and explicitly calling it with the -Dlogger.file option. 我设法使记录器在运行中添加logger.xml文件,并使用-Dlogger.file选项显式调用它。 I am a bit confused by the fact that all that should be logged bacause of the Global.onStart() method was correctly logged, while, after the application was started, there was no more logs (but only on dist mode, with the run mode logs where fine). 我对由于应正确记录Global.onStart()方法而应记录的所有内容这一事实感到困惑,而在应用程序启动后,不再有任何记录(但仅在dist模式下run模式日志就可以了)。

Maybe my issue is related with this other question . 也许我的问题与另一个问题有关

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM