有任何方法来指定在由Spring运行的JUnit中使用的logback配置文件吗?
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration("/my/app/springConfiguration.xml")
public class MyTest {
private static final Logger logger = LoggerFactory.getLogger(MyTest.class);
@Autowired
Something something;
} 现在,我得到了logback.xml和其中的多个。有一个应该运行在prod,然后有一个,我希望这个测试。有什么简单的方法吗?
编辑:这个问题是特定于当我从我的JUnit运行时的情况。我正在windows 7上开发Eclipse4.3。
发布于 2016-07-08 19:21:59
将位置作为JVM讨论在eclipse中运行测试的配置传递。
-Dlogback.configurationFile="fullpathtofile\logback.xml"https://stackoverflow.com/questions/24609485
复制相似问题