I'm trying to user Apache HTTPClient
in my project. Here does not required any logging for this application. So Can I use HTTPClient
without Commons-logging.jar
. Otherwise it will be a extra unnecessary burden for my distribution package.
Yes you can. As Hannes suggested - here is my own HttpClient maven setup:
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.3.1</version>
<exclusions>
<exclusion>
<artifactId>commons-logging</artifactId>
<groupId>commons-logging</groupId>
</exclusion>
</exclusions>
</dependency>
Next, since common-logging
is indeed a runtime dependency, you will need to define the SLF4J bridge for commons-logging
:
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jcl-over-slf4j</artifactId>
<version>1.7.5</version>
</dependency>
And finally, you will of course need to have a valid SLF4J configuration - here is mine:
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.5</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.0.11</version>
</dependency>
Hope this helps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With