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

自作多情 提交于 2019-12-25 03:10:35

问题


I wrote a play 2.2.1 application and I have problems with logging. 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. Everything perfectly works in dev mode and every class logs fine. When I run in dist mode, it stops logging after the application is started. Any idea about what I am doing wrong or what else could I check? Thanks in advance!


回答1:


I would check log level, probably try setting it explicitly (in conf): logger=DEBUG




回答2:


I managed to have the logger running adding a logger.xml file and explicitly calling it with the -Dlogger.file option. 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).

Maybe my issue is related with this other question.



来源:https://stackoverflow.com/questions/25995651/playframework-quit-logging-after-application-starts-but-works-for-global-onstar

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