You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by bu...@apache.org on 2005/11/29 18:55:40 UTC

DO NOT REPLY [Bug 37697] New: - console spam during connection errors from HttpMethodDirector w/java.util.logging

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=37697>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=37697

           Summary: console spam during connection errors from
                    HttpMethodDirector w/java.util.logging
           Product: HttpClient
           Version: 3.0 RC4
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Commons HttpClient
        AssignedTo: httpclient-dev@jakarta.apache.org
        ReportedBy: pmuellr@yahoo.com


In HttpClient 3.0RC4, when using java.util.logging (because log4j was not
available on the classpath), on a 1.4.2 JDK, you will see console spam if you
cannot connect to the server.  Like this:

Nov 29, 2005 12:50:44 PM org.apache.commons.httpclient.HttpMethodDirector
executeWithRetry
INFO: I/O exception (java.net.ConnectException) caught when processing request:
Connection refused: connect
Nov 29, 2005 12:50:44 PM org.apache.commons.httpclient.HttpMethodDirector
executeWithRetry
INFO: Retrying request
Nov 29, 2005 12:50:45 PM org.apache.commons.httpclient.HttpMethodDirector
executeWithRetry
INFO: I/O exception (java.net.ConnectException) caught when processing request:
Connection refused: connect
Nov 29, 2005 12:50:45 PM org.apache.commons.httpclient.HttpMethodDirector
executeWithRetry
INFO: Retrying request
Nov 29, 2005 12:50:46 PM org.apache.commons.httpclient.HttpMethodDirector
executeWithRetry
INFO: I/O exception (java.net.ConnectException) caught when processing request:
Connection refused: connect
Nov 29, 2005 12:50:46 PM org.apache.commons.httpclient.HttpMethodDirector
executeWithRetry

Here's the sample program:

import java.util.logging.Level;
import java.util.logging.Logger;

import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.HttpMethod;
import org.apache.commons.httpclient.methods.GetMethod;

public class TestHttpClient {

	static public void main(String[] args) throws Exception {
		
		Logger logger =
Logger.getLogger("org.apache.commons.httpclient.HttpMethodDirector");
//		logger.setLevel(Level.WARNING);
		
        HttpClient client = new HttpClient();

        client.getHttpConnectionManager().getParams().setConnectionTimeout(5000);

        String url = "http://localhost:12345";

        HttpMethod method = new GetMethod(url);
        method.setFollowRedirects(true);
        
        client.executeMethod(method);
        String responseBody = method.getResponseBodyAsString();		
	}
}

Note that if you uncomment out the logger.setLevel(Level.WARNING) invocation at
the top, no more spam.

Either these messages should not be logged at the apparently default level that
java.util.logging runs at (INFO), thus they should be logged as WARN; or you
should provide an API which would change the level at which they are logged. 
Having to hack an override for the logger like this is ... a hack.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-dev-help@jakarta.apache.org