如何在测试期间覆盖log4j.properties? [英] How to override log4j.properties during testing?

查看:109
本文介绍了如何在测试期间覆盖log4j.properties?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在maven测试期间将所有 DEBUG 消息记录到控制台。为此我创建了一个文件 src / test / resources / log4j.properties ,它将覆盖我在 src / main中已有的配置/resources/log4j.properties 。不幸的是,这种压倒一切都没有发生。为什么以及如何解决它?

I'm trying to log all DEBUG messages to console during testing in maven. For this purpose I created a file src/test/resources/log4j.properties, which is going to override the configuration I already have in src/main/resources/log4j.properties. Unfortunately such an overriding is not happening. Why and how to fix it?

推荐答案

它应该按原样工作,并且有效。问题出在其他地方。

It should work as it is, and it works. The problem is somewhere else.

ps。我的类路径中的记录器乱七八糟:jog4j,slf4j,logback(来自其他依赖项)。据我了解,他们都是冲突的。我还没有清理这个烂摊子,我仍然不知道如何让所有包使用一个日志工具和一个配置。

ps. I had a mess with loggers in my classpath: jog4j, slf4j, logback (from other dependencies). As I understand, all of them are in conflict. I didn't clean this mess yet, and I still don't know how to make all packages to use one logging facility and one configuration.

这篇关于如何在测试期间覆盖log4j.properties?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆