Redian新闻
>
ant junit and log4j can't work together
avatar
ant junit and log4j can't work together# Java - 爪哇娇娃
f*h
1
I tried to use them altogether, but there is a problem.
If I invoke junit from ant, it complains the log4j system
is not properly set up. But if I run my code directly from console
using java myclass there is no problem.
Any solution to this?
avatar
e*g
2
log4j conf file should be in classpath?

【在 f********h 的大作中提到】
: I tried to use them altogether, but there is a problem.
: If I invoke junit from ant, it complains the log4j system
: is not properly set up. But if I run my code directly from console
: using java myclass there is no problem.
: Any solution to this?

avatar
f*h
3
I am not using the conf file now, just use BasicConfigurator.configure()

【在 e***g 的大作中提到】
: log4j conf file should be in classpath?
avatar
f*h
4
I found my mistake. I should have put all the initialization code of log4j
in the same static group. Now it's working.

【在 f********h 的大作中提到】
: I am not using the conf file now, just use BasicConfigurator.configure()
avatar
m*t
5

What static group?

【在 f********h 的大作中提到】
: I found my mistake. I should have put all the initialization code of log4j
: in the same static group. Now it's working.

avatar
f*h
6
I mean something like
static {
your code goes here
}

【在 m******t 的大作中提到】
:
: What static group?

相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。