Different logfile for integration testing

亡梦爱人 提交于 2019-12-05 13:10:39

Conditional configuration (if statement) requires Janino. Is Janino available on your class path? Have you set the debug attribute to true as follows?

<configuration debug="true">...</configuration>

Setting the debug attribute to true will print logback's internal status messages on the console which can be very useful in tracking down logback configuration problems.

As for the separation question, have you considered separation by hostname? Logback automatically defines HOSTNAME as a variable. So the following would define two separate logging settings based on productionHost and other hosts.

<if condition='property("HOSTNAME").contains("productionHost")'>
    <then>...</then>
    <else>config for test</else>
</if>

Actually, I don't see why the separation according to the definition of 'logDir' is insufficient for achieving separation.

I would suggest to have separate module for the integration tests where you can put a different log file configuration (src/test/resources) and the configuration for the unit tests will be coming out of the module where you have put the unit tests into.

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