F
frank
Hello,
My question is about the Log4j logging system.
I wrote some code using the Spring JDBC framework and I wrote some
JUnit tests for my code. When I run the tests, Spring outputs thousands
of debug statements to Log4j, which end up in my test report, making it
very hard to read.
I appreciate the fact that Log4j is a complex system with many ways to
configure and control it. That's all well and good, but frankly, I
don't have time to spend a week learning how it works, and I'm not in
the mood to create a configuration file and figure out where it needs
to be when I run my tests. All I want to do is put a line or two of
code in my unit test that will shut off the offending log messages.
Can someone enlighten me?
I tried this, but it doesn't work:
org.apache.log4j.BasicConfigurator.configure();
LogManager.getLoggerRepository().setThreshold(Level.INFO);
My question is about the Log4j logging system.
I wrote some code using the Spring JDBC framework and I wrote some
JUnit tests for my code. When I run the tests, Spring outputs thousands
of debug statements to Log4j, which end up in my test report, making it
very hard to read.
I appreciate the fact that Log4j is a complex system with many ways to
configure and control it. That's all well and good, but frankly, I
don't have time to spend a week learning how it works, and I'm not in
the mood to create a configuration file and figure out where it needs
to be when I run my tests. All I want to do is put a line or two of
code in my unit test that will shut off the offending log messages.
Can someone enlighten me?
I tried this, but it doesn't work:
org.apache.log4j.BasicConfigurator.configure();
LogManager.getLoggerRepository().setThreshold(Level.INFO);