I would like to turn on logging for android's DefaultRedirectHandler.
I read the code, it uses org.apache.commons.loggenter code here
ing.LogFactory to set/check the log level.
Problem is when I try to get a reference to org.apache.commons.logging.LogFactory, that class is not visible to my application.
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
public class DefaultRedirectHandler implements RedirectHandler {
//... omitted
private final Log log = LogFactory.getLog(getClass());
String location = locationHeader.getValue();
if (this.log.isDebugEnabled()) {
this.log.debug("Redirect requested to location '" + location + "'");
}
//... omitted
I have followed the steps here: How to enable logging for apache commons HttpClient on Android
I have tried putting this in my apk: java.util.logging.Logger.getLogger("org.apache.http.impl.client").setLevel(java.util.logging.Level.FINEST); java.util.logging.Logger.getLogger("org.apache.http.impl.conn").setLevel(java.util.logging.Level.FINEST); java.util.logging.Logger.getLogger("org.apache.http.client").setLevel(java.util.logging.Level.FINEST);
System.setProperty("org.apache.commons.logging.Log", "org.apache.commons.logging.impl.SimpleLog");
System.setProperty("org.apache.commons.logging.simplelog.showdatetime", "true");
System.setProperty("org.apache.commons.logging.simplelog.log.org.apache.http.client", "debug");
System.setProperty("org.apache.commons.logging.simplelog.log.org.apache.http.impl.client", "debug");
System.setProperty("org.apache.commons.logging.simplelog.log.org.apache.http.impl.conn", "debug");
But that does not help me. I am testing on a Gingerbread device.
Thank you for any help.