Title: [httpclient] logging and testing changes

(My apologies if this comes through with an HTML attachment.  Our admin recently upgraded our exchange server and seems to be having trouble getting the "stop-sending-the-annoying-attachment" patch/config set up again.)

Fair warning:

I'd like to convert the System.out/System.err logging currently used in httpclient over to using log4j, for the following reasons:

* The current logging configuration is cumbersome--it requires a code change and recompilation to turn logging on and off.  Several times over the past few days I've wanted to quickly turn logging on or off in a production installation of httpclient, and have had to replace the JAR outright--which may be changing things other than what I wanted to change.

* Many of the projects using this component probably already use log4j for other logging, so making it all work the same way would be helpful.

* Previously on this list we seem to have come to a consensus (or at least as close to a consensus as this list ever comes to) that log4j should be the conventional logging mechanism

* Given the charter of this project, it seems appropriate that we use bits of other jakarta/apache projects where relevant.

Doing this will of course require that log4j.jar be available in your classpath at runtime and at compile time.  It can be obtained from http://jakarta.apache.org/log4j.  I hope this isn't too onerous a dependency.

The Categories I have currently set up are relatively crude--one category per class that has logging (there are three of them).  We could and probably should be more clever with that.  Perhaps a "verbose" and "terse" logging category?  I'll probably check my changes in a little later this afternoon, and anyone who wants to play with new/differnt logging categories should feel free.

--

Also (and I suspect this will be less controversial), I have refactored the TestMethods class to separate those tests which depend upon external internet access from those which can be run against locahost alone.  There are now three test targets:

 * test - runs all unit tests, as before
 * test-local - runs all unit tests that don't depend upon external network access
 * test-external - runs all unit tests that don't depend upon a webserver running locally

This makes it easier for those of us who like to do development offline, and is pretty painless (invisible even) for everyone else.

 - Rod

Reply via email to