Remove org.apache.http.wire logs
I was trying to run test cases that connects to SOLR – or uses any sort of http request- using
JUnit, I could see many log lines starting with
DEBUG org.apache.http.wire
This heavy
logging causes inaccurate results if you are concerned with measuring
performance or calculating time span for a certain http request ... for example a request that takes actually 1 second appears in the eclipse console to take 6 seconds !!
To
remove these logs , do the following :
11 - In ur TestCases class put
these imports:
import org.slf4j.LoggerFactory;
import ch.qos.logback.classic.Level;
import
ch.qos.logback.classic.Logger;
22 - In the start of
the test method, put the following code lines
Logger root = (Logger)LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME);
root.setLevel(Level.ERROR);
33 - In your pom.xml,
put
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.0.13</version>
</dependency>
Or if
you u already have this dependency, just remove the following line -if exists-
<scope>runtime</scope>
in
order to compile.
Hope it helps
No comments:
Post a Comment