hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oleg Kalnichevski <ol...@apache.org>
Subject Re: How to use logging abilities of HttpClient?
Date Tue, 10 Apr 2012 12:13:50 GMT
On Tue, Apr 10, 2012 at 02:01:21PM +0200, tommmmmm wrote:
> After commenting out, my test statement doesn't get printed. And before you
> ask: I checked if the levels are preserved i.e. if DEBUG  > INFO > WARN >
> FATAL. Yet it is.
> 
> The file gets read, because if I provide wrong path it throws exception
> FileNotFound. So the path is good (How many times must I prove it). Also,
> in log4j documentation it's said only one log file can exist, so if there
> was another one somewhere else I would have gotten warning for trying to
> overwrite it. Furthermore. I am loading a config file with root logger as
> DEBUG like 2 lines before calling HttpClient. So even if there was some
> other config file, my root settings should overwrite it because
> a) they are root settings
> b) I set the settings 2 lines before executing HttpClient, so the system
> has no possibility to load OTHER settings.
> 
> Another proof: And if there WERE predefined settings for HttpClient that
> ARE impossible to override, then why would HttpClient provide logging
> interface at all? That was an ad absurdum proof.
> 
> So, why it doesn't work at all?
> 
> and btw. log4j.properties is NOT in classpath and never will be. That's why
> I use PropertyConfigurator.configure(POINTING_TO_THE_F***_FILE);
> And before you ask, I did so prior to using propertyConfigurator - the
> properties file was in "src" a'ka "default package". But:
> 1. It didnt work
> 2. Why am I being FORCED to use <Default package> ??? it's bad programming
> style. AND I have seen log4j working somewhere else without that forced
> bound. So it CAN work. But it DOESN'T with HttpClient. How much more must I
> emphasize that?
> 
> 

Sort out your local mess. HttpClient DOES NOT enforce any particular logging configuration.
It uses Commons Logging API. You cannot blame Log4j configuration issues on HttpClient.

Oleg


> On 10 April 2012 13:42, Ryan Smith <ryan.justin.smith@gmail.com> wrote:
> 
> > It is possible that your app might be reading a log4j config file somewhere
> > in a jar.  If you want to test, try commenting out your
> > "PropertyConfigurator" line and see if your debug statement in your code
> > still works.  My guess is your log4j.properties file isnt on your
> > CLASSPATH.  Usually src folders arent on the CLASSPATH unless you add them
> > yourself.  If all else fails, try adding the absolute file path of your
> > log4j.properties file to your CLASSPATH.
> >
> > hth,
> > -Ryan

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


Mime
View raw message