如何在twitter4j中禁用请求信息

时间:2015-06-24 05:59:04

标签: java log4j slf4j twitter4j

我们正在使用twitter4j 4.0.2版本。我正在尝试使用以下方法在twitter4j中测试一个简单的搜索方法..

    Showing user timeline with sinceId 325093657755664384
- Request: 
- GET https://api.twitter.com/1.1/statuses/user_timeline.json?screen_name=zupaen&include_my_retweet=true&since_id=325093657755664384&count=1000&page=1&include_entities=true
- OAuth base string: GET&https%3A%2F%2Fapi.twitter.com%2F1.1%2Fstatuses%2Fuser_timeline.json&count%3D1000%26include_entities%3Dtrue%26include_my_retweet%3Dtrue%26oauth_consumer_key%3DuLUgGGRcTXEze0EiWCkQBA%26oauth_nonce%3D3102424186%26oauth_signature_method%3DHMAC-SHA1%26oauth_timestamp%3D1435119675%26oauth_token%3D381419856-es7hoezmhTFYzZCdHv2NC0I2BKKxEpRNVVtckmEt%26oauth_version%3D1.0%26page%3D1%26screen_name%3Dzupaen%26since_id%3D325093657755664384
- OAuth signature: BFamj/t8En4xLd5s9AJJrzPLlos=
- Authorization: **********************************************************************************************************************************************************************************************************************************************************************************
- X-Twitter-Client-URL: http://twitter4j.org/en/twitter4j-4.0.2.xml
- X-Twitter-Client: Twitter4J
- Accept-Encoding: gzip
- User-Agent: twitter4j http://twitter4j.org/ /4.0.2
- X-Twitter-Client-Version: 4.0.2
- Response: 
- x-frame-options: SAMEORIGIN
- content-type: application/json;charset=utf-8
- HTTP/1.1 200 OK
- x-response-time: 601
- content-encoding: gzip
- date: Wed, 24 Jun 2015 04:21:17 GMT
- x-transaction: 96486c0b45e7885a
- cache-control: no-cache, no-store, must-revalidate, pre-check=0, post-check=0
- x-content-type-options: nosniff
- x-rate-limit-limit: 180
- expires: Tue, 31 Mar 1981 05:00:00 GMT
- content-disposition: attachment; filename=json.json
- x-twitter-response-tags: BouncerCompliant
- x-access-level: read-write
- x-rate-limit-remaining: 179
- last-modified: Wed, 24 Jun 2015 04:21:17 GMT
- status: 200 OK
- pragma: no-cache
- x-connection-hash: 3ec71711d1f6a34a8fd3a83625a61468
- x-xss-protection: 1; mode=block
- set-cookie: guest_id=v1%3A143511967707573850; Domain=.twitter.com; Path=/; Expires=Fri, 23-Jun-2017 04:21:17 UTC
- set-cookie: lang=en; Path=/
- content-length: 15167
- x-rate-limit-reset: 1435120577
- server: tsa_k
- strict-transport-security: max-age=631138519
- [
 {
  "contributors": null,
  "coordinates": null,
  "created_at": "Mon Jun 22 13:01:03 +0000 2015",
  "entities": {
   "hashtags": [],
   "symbols": [],
   "urls": [],
   "user_mentions": []
  },
  "favorite_count": 0,
  "favorited": false,
  "geo": null,
  "id": 612968542250504192,
  "id_str": "612968542250504192",
  "in_reply_to_screen_name": null,
  "in_reply_to_status_id": null,
  "in_reply_to_status_id_str": null,
  "in_reply_to_user_id": null,
  "in_reply_to_user_id_str": null,
  "is_quote_status": false,
  "lang": "en",
  "place": {
   "attributes": {},
   "bounding_box": {
    "coordinates": [[
     [
      -119.384597,
      36.150891
     ],
     [
      -119.295915,
      36.150891
     ],
     [
      -119.295915,
      36.2404878
     ],
     [
      -119.384597,
      36.2404878
     ]
    ]],
    "type": "Polygon"
   },
   "contained_within": [],
   "country": "United States",
   "country_code": "US",
   "full_name": "Tulare, CA",
   "id": "07f82da44bfd9cb2",
   "name": "Tulare",
   "place_type": "city",
   "url": "https://api.twitter.com/1.1/geo/id/07f82da44bfd9cb2.json"
  },

运行代码时,我收到以下请求信息。我需要禁用请求信息......

log4j.rootCategory=TRACE, CONSOLE
log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
log4j.appender.CONSOLE.Threshold=TRACE
log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
log4j.appender.CONSOLE.layout.ConversionPattern=- %m%n
log4j.logger.twitter4j.internal.http=warn

我的log4j.properties如下..

grep -i -E -c -e '(^|<SOH>)[^=]*=APPLE<SOH>'

我也通过谷歌搜索说:将其添加到log4j.properties:log4j.logger.twitter4j.internal.http = warn here

我的属性文件具有此属性但仍获取请求信息。如何在twitter4j中禁用请求信息?

0 个答案:

没有答案