java - Suppress HtmlUnit Apache logging -
i want suppress logs of apache's httpclient when using htmlunit. i'm using htmlunit 2.27 jdk logging. everytime explicitly set level of 'org.apache.http.wire' off, htmlunit resets level null.
for example:
//turn on logging for(java.util.logging.handler item : logger.getlogger("").gethandlers()) { item.setlevel(java.util.logging.level.all); } logger.getlogger("").setlevel(java.util.logging.level.fine); //suppress apache logs java.util.logging.logger.getlogger("org.apache.http.wire").setlevel(java.util.logging.level.off); //closeablehttpclient httpclient = httpclients.createdefault(); (new webclient()).getpage("https://publicobject.com/helloworld.txt"); system.out.println("org.apache.http.wire=" + java.util.logging.logger.getlogger("org.apache.http.wire").getlevel());
this returns:
org.apache.http.wire=null
if use apache httpclient directly or reference apache httpclient before htmlunit (i.e. uncomment closeablehttpclient line), logging suppressed , output returns:
org.apache.http.wire=off
any ideas on how suppress "org.apache.http.wire" logs without hack of referencing closeablehttpclient before htmlunit?
simple fix: don't use java.util.logging. once switch commons logging use log4j, worked expected. assume it's bug java.util.logging , htmlunit...
Comments
Post a Comment