问题描述
当我在Localhost:9000/@tests#中启动测试时,我可以看到带有调试日志级别的log log.我想摆脱这一点.我试图将我的应用程序放入我的应用程序.conf
类似:
application.log=INFO
甚至这线:
application.log.system.out=off
但它行不通.也许我应该以某种方式将log4j设置为测试上下文.?
推荐答案
您可以简单地将这两个规则带有"测试" ID.
%test.application.log.system=off %test.application.log=ERROR
,顺便说一句,日志级别为:trace - > debug - > info - > warn - > error - > - > fatal fatal
因此,在显示info时,您正在显示许多信息.
其他推荐答案
您的log4j.properties配置是什么?您很可能在其中启用了调试.
如果启用了此设置:
application.log.path=/log4j.properties
尝试将其禁用并运行测试以验证这正在更改日志.如果是问题,则将该行修改为:
%test.application.log.path=/log4j-test.properties %dev.application.log.path=/log4j-dev.properties
并创建2个版本的log4j.properties,因此您的日志记录级别正确.
问题描述
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..?
推荐答案
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.
其他推荐答案
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.