Play framework logger not picking format after packaging

前端 未结 1 1099
孤街浪徒
孤街浪徒 2020-12-21 07:22

I have formatted the logs generated by play using logger.xml file in conf folder to get the desired format. In my local environment when i am using

相关标签:
1条回答
  • 2020-12-21 07:50

    You seem to be using Play 2.0.x - 2.1.x based on the fact that you are using the start script generated by play stage or play dist. According to this section in the docs and assuming your logger.xml is in your conf directory, then the suggested correct config for your file would be:

    sudo ./start -Dlogger.resource=logger.xml
    

    However, it turns out that if you name your Logback config file logger.xml then Play seems to pick the default logger.xml config file from the classpath and not yours. Which is probably why the name of the config file in the docs is called prod-logger.xml and not just logger.xml, however that is not explicitly explained.

    So rename your logger.xml file to something else. For example test-logger.xml and then the following will correctly pick your Logback config:

    sudo ./start -Dlogger.resource=test-logger.xml
    
    0 讨论(0)
提交回复
热议问题