log4j⽇志不正常,不输出到控制台问题问题:我的myeclipse 2014由于⼀些原因不打印console⽇志。
解决⽅法:
1. 在运⾏的VM的参数⾥⾯增加-Dlog4j.debug 打印出log4j的测试信息。
2. 或者在VM参数⾥⾯强制增加log4j配置⽂件地址: -
⼀般你应该通过第⼀步到原因然后根据情况解决
如何加参数:
1. 如果你是⽤的run/debug
右键->run/debug下⾯有⼀个run configurations/debug
configurations->(x)=Arguments->下⽅有个VM
arguments: 把参数加到⾥⾯,选apply和run/debug就可以
了。
2. 如果你是⽤的myeclipse,要在Tomcat->Tomcat n.x-
>JDK->Optional Java VM arguments下增加 -
Dlog4j.debug
原
⽂:stackoverflow/questions/3501355/log4j-
output-not-displayed-in-eclipse-console
For some reason my Eclipse console no longer displays Log4j
INFO and DEBUG statements when I run JUnit tests. In terms of
code there hasn't been any change, so it must something to do
with the Eclipse configuration.
All I do in my Unit test is the following and for some reason
ONLY the ERROR statement is displayed in the Eclipse
console. Why? Where shall I look for clues?
public class SampleTest
{
log4j2不打印日志private static final Logger LOGGER = Logger(SampleTest.class);
@Before
public void init() throws Exception
{
// Log4J junit configuration.
LOGGER.info("INFO TEST");
LOGGER.debug("DEBUG TEST");
<("ERROR TEST");
}
}
Details:
log4j-1.2.6.jar
junit-4.6.jar Eclipse
IDE for Java Developers, Version: Helios Release, Build id:
20100617-1415
java eclipse junit log4j
share|improve this question edited Aug 17 '10 at
10:21
leppie
68.9k8106203
asked Aug 17 '10 at
10:11
javaExpert
1242210
add a comment
Look in the log4j.properties l file for the log level. It's probably set to ERROR instead of
command line with log4j.jar and log4j.properties on your classpath.
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论