Playframework quit logging after application start

2019-08-19 03:18发布

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!

2条回答
啃猪蹄的小仙女
2楼-- · 2019-08-19 03:23

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

查看更多
Evening l夕情丶
3楼-- · 2019-08-19 03:28

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.

查看更多
登录 后发表回答