log4j:WARN No appenders could be found for logger (org.apache.commons.httpclient.HttpClient).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.上面是报错信息,请问我该怎么办?

解决方案 »

  1.   

    没有初始化log4j!
    是否调用了log4j.perproties?
      

  2.   

    实话说吧,我第一次用HttpClient,从网上下了段代码,想先运行下看看效果,结果就出这个错误了。网上找到的代码是:public class tg {
        public static void main(String[] args) throws IOException
        {
            HttpClient client = new HttpClient();
            client.getHostConfiguration().setHost("www.imobile.com.cn", 80, "http");
            HttpMethod method = getPostMethod();//使用POST方式提交数据
         client.executeMethod(method);
           //打印服务器返回的状态
         System.out.println(method.getStatusLine());
           //打印结果页面
        String response =   new String(method.getResponseBodyAsString().getBytes("8859_1"));
           //打印返回的信息
         System.out.println(response);
            method.releaseConnection();
        }
        /**
         * 使用GET方式提交数据
       * @return
         */
        private static HttpMethod getGetMethod(){
            return new GetMethod("/simcard.php?simcard=1330227");
        }
        /**
         * 使用POST方式提交数据
       * @return
         */
        private static HttpMethod getPostMethod(){
            PostMethod post = new PostMethod("/simcard.php");
            NameValuePair simcard = new NameValuePair("simcard","1330227");
            post.setRequestBody(new NameValuePair[] { simcard});
            return post;
        }
      

  3.   

    log4j:WARN Please initialize the log4j system properly.请初始化 log4j system properly.
      

  4.   

    去apache官网下载log4j的Jar包,编写log4j的配置文件。
      

  5.   

    嘎嘎,我是自己写的 Log 系统,现有的比较流行的 Log 系统用起来都有这个那个的不足,只好自己写一个了。
      

  6.   

    在 classpath里找不到 log4j.properties / log4j.xml
      

  7.   


    应该就是这个,在src下面放log4j.properties,自己写一个或者网上copy一个