Resend: disable httpclient logging
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 #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 3. in its classpath, it contains both httpclient-20.jar and struts-plus-apache-commons.jar 4. I change the last line to be one of the following: 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 darren jiang wrote: hello all, I want to disable the httpclient logging. but failed to do so, anyone has the same issue with me? my program uses log4j and also org.apache.commons packages. I have my own logging.properties as following: jdap.log.dir=/var/opt/SUNWappserver7/domains/cvmdomain/cvminstance/logs log4j.rootCategory=DEBUG, ae, debug, metrics log4j.appender.ae=org.apache.log4j.FileAppender log4j.appender.ae.layout=org.apache.log4j.PatternLayout log4j.appender.ae.layout.ConversionPattern=%d{-MM-dd HH:mm:ss.SSS}; ${jdap. hostname}; %x; %C -%m%n log4j.appender.ae.Threshold=ERROR log4j.appender.ae.ImmediateFlush=true log4j.appender.ae.File=${jdap.log.dir}/${jdap.hostname}CVM_JdapBatchAe.log log4j.appender.ae.Append=true log4j.appender.debug=org.apache.log4j.FileAppender log4j.appender.debug.layout=org.apache.log4j.PatternLayout log4j.appender.debug.layout.ConversionPattern=%d{-MM-dd HH:mm:ss.SSS}; ${jd ap.hostname}; %x; %l -%m%n log4j.appender.debug.Threshold=DEBUG log4j.appender.debug.ImmediateFlush=true log4j.appender.debug.File=${jdap.log.dir}/${jdap.hostname}CVM_JdapBatchDebug.lo g log4j.appender.debug.Append=true log4j.appender.metrics=org.apache.log4j.FileAppender log4j.appender.metrics.layout=org.apache.log4j.PatternLayout log4j.appender.metrics.layout.ConversionPattern=%d{-MM-dd HH:mm:ss.SSS}; ${ jdap.hostname}; %x; %l -%m%n log4j.appender.metrics.Threshold=INFO log4j.appender.metrics.ImmediateFlush=true log4j.appender.metrics.File=${jdap.log.dir}/${jdap.hostname}CVM_JdapBatchMetric s.log log4j.appender.metrics.Append=true # HttpClient logging set to be ERROR log4j.category.org.apache.commons=ERROR the all httpclient logging still go to my logging files. I tried to change log4j.category to be log4j.logger. but that does not help. many thanks darren jiang - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Resend: disable httpclient logging
Hello Ortwin, thank you for your help to indentify the reason for this. I did a configuration in my program to use the passed in logging.properties file. I put my code here. - public static void main(String[] args) { if(!checkParameters(args)) { System.out.println(parameter error:); System.out.println(parameter: ALL|RENEWSUB|CANCELSUB); System.exit(-1); } // prepare the system properties String logFile = System.getProperty(log.file); String logConfigFile = System.getProperty(java.util.logging.config.file); System.out.println(log File = + logFile); System.out.println(log ConfigFile = + logConfigFile); // config log4j system PropertyConfigurator.configure(logConfigFile); //use NDC to format log4 entries NDC.clear(); NDC.push(Constants.APPLICATION_DEBUG); - so the program should use log4j logging API in my program, and the configuration parameters is in my passed in BatchLog.properties then the program should disable the debug logging for org.apache.commons package and sub package. but it did not stop the debugging, particular the WIRE package. 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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: disable httpclient logging
Hello Doug, It is stand alone program, I also felt weird. in theory, that should disable the debug log. I will check the cofiguration to see if the program use the right properties file. many thanks Darren Jiang Doug wrote: darren jiang wrote: hello all, I want to disable the httpclient logging. but failed to do so, anyone has the same issue with me? snip # HttpClient logging set to be ERROR log4j.category.org.apache.commons=ERROR the all httpclient logging still go to my logging files. I tried to change log4j.category to be log4j.logger. but that does not help. many thanks darren jiang Weird. That works for me. An exact cut/paste from my file: log4j.logger.org.apache.commons.httpclient=ERROR What's your environment? Standalone application? J2EE server? Which one? Doug - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
disable httpclient logging
hello all, I want to disable the httpclient logging. but failed to do so, anyone has the same issue with me? my program uses log4j and also org.apache.commons packages. I have my own logging.properties as following: jdap.log.dir=/var/opt/SUNWappserver7/domains/cvmdomain/cvminstance/logs log4j.rootCategory=DEBUG, ae, debug, metrics log4j.appender.ae=org.apache.log4j.FileAppender log4j.appender.ae.layout=org.apache.log4j.PatternLayout log4j.appender.ae.layout.ConversionPattern=%d{-MM-dd HH:mm:ss.SSS}; ${jdap. hostname}; %x; %C -%m%n log4j.appender.ae.Threshold=ERROR log4j.appender.ae.ImmediateFlush=true log4j.appender.ae.File=${jdap.log.dir}/${jdap.hostname}CVM_JdapBatchAe.log log4j.appender.ae.Append=true log4j.appender.debug=org.apache.log4j.FileAppender log4j.appender.debug.layout=org.apache.log4j.PatternLayout log4j.appender.debug.layout.ConversionPattern=%d{-MM-dd HH:mm:ss.SSS}; ${jd ap.hostname}; %x; %l -%m%n log4j.appender.debug.Threshold=DEBUG log4j.appender.debug.ImmediateFlush=true log4j.appender.debug.File=${jdap.log.dir}/${jdap.hostname}CVM_JdapBatchDebug.lo g log4j.appender.debug.Append=true log4j.appender.metrics=org.apache.log4j.FileAppender log4j.appender.metrics.layout=org.apache.log4j.PatternLayout log4j.appender.metrics.layout.ConversionPattern=%d{-MM-dd HH:mm:ss.SSS}; ${ jdap.hostname}; %x; %l -%m%n log4j.appender.metrics.Threshold=INFO log4j.appender.metrics.ImmediateFlush=true log4j.appender.metrics.File=${jdap.log.dir}/${jdap.hostname}CVM_JdapBatchMetric s.log log4j.appender.metrics.Append=true # HttpClient logging set to be ERROR log4j.category.org.apache.commons=ERROR the all httpclient logging still go to my logging files. I tried to change log4j.category to be log4j.logger. but that does not help. many thanks darren jiang - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]