Log level in tests for PlayFramwork 1.x

2019-07-28 09:54发布

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..?

2条回答
相关推荐>>
2楼-- · 2019-07-28 10:05

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.

查看更多
太酷不给撩
3楼-- · 2019-07-28 10:23

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.

查看更多
登录 后发表回答