You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by darren jiang <Da...@Sun.COM> on 2004/06/22 07:38:11 UTC

RESULT: possible bugs:( Re: Resend: disable httpclient logging)

Hello Ortwin and all,

I fixed this problem and found that maybe a bug in HttpClient.java

I fixed the logging problem using the following:

#set error for commons package:
log4j.category.org.apache.commons.httpclient=ERROR

this can only disable the logging for all package except HttpClient.class.


going to the source code, and found following in HttpClient.java

----------------------

private static final Log LOG=LogFactory.getLog(HttpClient.class)

-----------------------

that is why I can not disable the logging for HttpClient.wire

I am using following to disable org.apache.commons debugging:

----------------
log4j.category.org.apache.commons=ERROR, debug, metrics
log4j.category.httpclient=ERROR, debug, metrics
-----------------

this makes the log4j works for my program.

so, I 'd like to raise the the bug in HttpClient, the log object should 
use its package "org.apache.commons.httpclient.HttpClient", rather than 
"HttpClient"

many thanks!


Darren Jiang




Ortwin Glück wrote:

>
>
> darren jiang wrote:
>
>> additional info:
>>
>> 1.  this is a standalone java program,
>>
>> 2. the script to launch the java process as follows:
>>
>> ---------------------
>>
>> #!/bin/sh
>> CDS_HOME=/opt/cvm
>> CDS_RUNTIME=$CDS_HOME/deployment/cvm
>> echo "CDS_HOME =$CDS_HOME"
>> echo "CDS_RUNTIME=$CDS_RUNTIME"
>> #classpath for CDS_RUNTIME
>> CLASSPATH=../.:$CDS_HOME/enhancements/lib/commons-httpclient-2.0.jar:$CDS_RUNTIM 
>>
>> E/lib/struts-plus-apache-commons.jar:$CDS_RUNTIME/lib/log4j-1.2.8.jar:$CDS_RUNTI 
>>
>> ME/lib/cdslib/cdsapi.jar:$CDS_RUNTIME/lib/cdslib/foundation.jar:$CDS_RUNTIME/ser 
>>
>> vice/postpaidservice/lib/postpaidservice.jar:$CDS_HOME/enhancements/lib/infranet 
>>
>> /cdk.jar:$CDS_HOME/enhancements/lib/infranet/pcm.jar:$CDS_HOME/enhancements/lib/ 
>>
>> infranet/pcmext.jar:$CDS_HOME/enhancements/enhancements.jar:$CDS_HOME/enhancemen 
>>
>> ts
>
>
>
> The classpath contains Log4J. So Log4J will be used by commons-logging.
>
>>
>> #classpath for deactive Account /cancel subscription
>> CLASSPATH=$CLASSPATH:$CDS_RUNTIME/lib/classes12.zip:$CDS_RUNTIME/lib/xerces.jar: 
>>
>> $CDS_RUNTIME/lib/xalan.jar
>> echo $CLASSPATH
>> $JAVA_HOME/bin/java 
>> -Djava.util.logging.config.file=/opt/cvm/enhancements/BatchL
>> og.properties -cp $CLASSPATH com.telstra.cvm.cancellation.BatchMain $1
>>
>
> The java.util.logging property will be ignored, since Log4J is 
> preferred over JDK1.4 logging.
>
>> --------------------
>>
>> 3. in its classpath, it contains both httpclient-20.jar and 
>> struts-plus-apache-commons.jar
>
>
> I think HttpClient is not shipped with Struts. No problem here.
>
>> 4. I change the last line to be one of the following:
>
>
> In which file? The default config file for Log4J is log4j.properties 
> and is expected on the top level of the classpath. If you want to use 
> a different filename or location you must configure Log4J manually 
> from within your application.
>
>>       a) log4j.logger.org.apache.commons=ERROR
>>
>>       b) log4j.category.org.apache.commons=ERROR
>>
>>       c) log4j.logger.org.apache.commons.httpclient=ERROR
>>
>>    NONE of them works!
>>
>>
>> ANYONE CAN THINK OF THE REASON?
>>
>> many thanks!
>>
>>
>> Darren Jiang
>
>
>



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


Re: RESULT: possible bugs:( Re: Resend: disable httpclient logging)

Posted by Roland Weber <RO...@de.ibm.com>.
Hi Odi,

> Maybe we should also change the wirelog logger to something like 
> 'org.apache.commons.httpclient.wire'.
> 
The JLogFactory uses different methods to obtain loggers for a
class and by name. Prefixing the name with a package is OK by me,
but I'd prefer to leave some distinction in the naming scheme.
Maybe 'org.apache.commons.httpclient.WIRE'. Or use some special
characters no sane person would want to have in a class name,
though they are acceptable in a property name.

cheers,
  Roland

Re: RESULT: possible bugs:( Re: Resend: disable httpclient logging)

Posted by Ortwin Glück <or...@nose.ch>.

darren jiang wrote:
> ----------------------
> 
> private static final Log LOG=LogFactory.getLog(HttpClient.class)
> 
> -----------------------
> 
> that is why I can not disable the logging for HttpClient.wire

No, this is absolutely correct.

> I am using following to disable org.apache.commons debugging:
> 
> ----------------
> log4j.category.org.apache.commons=ERROR, debug, metrics
> log4j.category.httpclient=ERROR, debug, metrics
> -----------------

That is correct.

> this makes the log4j works for my program.
> 
> so, I 'd like to raise the the bug in HttpClient, the log object should 
> use its package "org.apache.commons.httpclient.HttpClient", rather than 
> "HttpClient"

It's 'HttpClient.class' that means that the fully qualified class name 
will be used as the logger. So it's correct as it is.

What you are seeing is the wirelog. The wirelog in 2.0 uses the logger 
'httpclient.wire'. This not well documented in the logging guide - good 
point. We should sort it out.
Maybe we should also change the wirelog logger to something like 
'org.apache.commons.httpclient.wire'.

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