Log level in tests for PlayFramwork 1.x

隐身守侯 提交于 2019-12-13 01:17:51

问题


When I launch my tests in localhost:9000/@tests# in console I can see long-long log with DEBUG log-level. I want to get rid of that. I tried to put to my application.conf

line like:

application.log=INFO

or even this line:

application.log.system.out=off

But it does not work. Maybe I should put log4j setting specially for test context somehow..?


回答1:


You can simply prefix those two rules with the "test" id.

%test.application.log.system=off
%test.application.log=ERROR

And by the way log levels are : trace -> debug -> info -> warn -> error -> fatal

So when displaying info, you are displaying a lot of information.




回答2:


What's your log4j.properties configuration? Most likely you have Debug enabled in there.

If you have this setting enabled:

   application.log.path=/log4j.properties

try to disable it and run the tests to verify this is changing the logs. If that's the issue then modify that line to:

  %test.application.log.path=/log4j-test.properties
  %dev.application.log.path=/log4j-dev.properties

and create the 2 versions of log4j.properties, so you have the right logging level in each.



来源:https://stackoverflow.com/questions/7992945/log-level-in-tests-for-playframwork-1-x

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