如何停止DEBUG LOGS

时间:2015-08-12 12:53:51

标签: debugging logging twitter twitter-rest-api

我想要获取推特的旧推文。为此,我使用了Twitter Rest Api和火花流。 相关代码如下。

    def fetchTweets(consumerKey : String ,consumerSecret :String ,accessToke:String ,accessTokenSecret :String)
       : String={
    val twitterFactory = new TwitterFactory()
    val twitter = twitterFactory.getInstance
    twitter.setOAuthConsumer(consumerKey, consumerSecret)
    twitter.setOAuthAccessToken(new AccessToken(accessToken, accessTokenSecret))
    val home=twitter.getHomeTimeline()
    var count=0
    var result=new StringBuilder
    while(count <20)
    {
      var status=home.get(count)
      var text =status.getText()
      var user=status.getUser()
      var screenName =user.getScreenName()
      var userName=user.getName()
      var location= user.getLocation()
      var dateTime=user.getCreatedAt()
      val fields: String= userName +Constants.SEPARATOR + screenName +Constants.SEPARATOR+ location+Constants.SEPARATOR + dateTime +Constants.SEPARATOR + text
      result.append(fields+"/n")
      count=count+1
    } 
       result.toString().dropRight(1)
  }

但它显示调试日志。

17:33:49.289 [http-bio-7777-exec-6] DEBUG twitter4j.HttpClientImpl -Twitter-Client: Twitter4J
17:33:49.289 [http-bio-7777-exec-6] DEBUG twitter4j.HttpClientImpl - Accept-Encoding: gzip
17:33:49.289 [http-bio-7777-exec-6] DEBUG twitter4j.HttpClientImpl - User-Agent: twitter4j http://twitter4j.org/ /4.0.2
17:33:49.289 [http-bio-7777-exec-6] DEBUG twitter4j.HttpClientImpl - X-Twitter-Client-Version: 4.0.2
17:33:50.692 [http-bio-7777-exec-6] DEBUG twitter4j.HttpClientImpl - Response:
17:33:50.693 [http-bio-7777-exec-6] DEBUG twitter4j.HttpClientImpl - content-type: application/json;charset=utf-8
17:33:50.693 [http-bio-7777-exec-6] DEBUG twitter4j.HttpClientImpl - x-frame-options: SAMEORIGIN
17:33:50.693 [http-bio-7777-exec-6] DEBUG twitter4j.HttpClientImpl - HTTP/1.1 200 OK
17:33:50.693 [http-bio-7777-exec-6] DEBUG twitter4j.HttpClientImpl - x-response-time: 48
17:33:50.693 [http-bio-7777-exec-6] DEBUG twitter4j.HttpClientImpl - content-encoding: gzip
17:33:50.693 [http-bio-7777-exec-6] DEBUG twitter4j.HttpClientImpl - date: Wed, 12 Aug 2015 12:33:50 GMT
17:33:50.693 [http-bio-7777-exec-6] DEBUG twitter4j.HttpClientImpl - x-transaction: 5a0d123fdb5e88b9
17:33:50.693 [http-bio-7777-exec-6] DEBUG twitter4j.HttpClientImpl - cache-control: no-cache, no-store, must-revalidate, pre-check=0, post-check=0
17:33:50.693 [http-bio-7777-exec-6] DEBUG twitter4j.HttpClientImpl - x-content-type-options: nosniff
17:33:50.693 [http-bio-7777-exec-6] DEBUG twitter4j.HttpClientImpl - expires: Tue, 31 Mar 1981 05:00:00 GMT
17:33:50.693 [http-bio-7777-exec-6] DEBUG twitter4j.HttpClientImpl - x-rate-limit-limit: 15
17:33:50.693 [http-bio-7777-exec-6] DEBUG twitter4j.HttpClientImpl - content-disposition: attachment; filename=json.json
17:33:50.694 [http-bio-7777-exec-6] DEBUG twitter4j.HttpClientImpl - x-twitter-response-tags: BouncerCompliant
17:33:50.694 [http-bio-7777-exec-6] DEBUG twitter4j.HttpClientImpl - x-access-level: read-write-directmessages
17:33:50.694 [http-bio-7777-exec-6] DEBUG twitter4j.HttpClientImpl - x-rate-limit-remaining: 14
17:33:50.694 [http-bio-7777-exec-6] DEBUG twitter4j.HttpClientImpl - last-modified: Wed, 12 Aug 2015 12:33:50 GMT
17:33:50.694 [http-bio-7777-exec-6] DEBUG twitter4j.HttpClientImpl - status: 200 OK
17:33:50.694 [http-bio-7777-exec-6] DEBUG twitter4j.HttpClientImpl - pragma: no-cache
17:33:50.694 [http-bio-7777-exec-6] DEBUG twitter4j.HttpClientImpl - x-connection-hash: 9fe1f9f4890f4b0f072fb56c1b32c2ee
17:33:50.694 [http-bio-7777-exec-6] DEBUG twitter4j.HttpClientImpl - x-xss-protection: 1; mode=block
17:33:50.694 [http-bio-7777-exec-6] DEBUG twitter4j.HttpClientImpl - set-cookie: guest_id=v1%3A143938283093070752; Domain=.twitter.com; Path=/; Expires=Fri, 11-Aug-2017 12:33:50 UTC
17:33:50.694 [http-bio-7777-exec-6] DEBUG twitter4j.HttpClientImpl - set-cookie: lang=en; Path=/
17:33:50.694 [http-bio-7777-exec-6] DEBUG twitter4j.HttpClientImpl - content-length: 9512
17:33:50.694 [http-bio-7777-exec-6] DEBUG twitter4j.HttpClientImpl - x-rate-limit-reset: 1439383730
17:33:50.694 [http-bio-7777-exec-6] DEBUG twitter4j.HttpClientImpl - server: tsa_a

有谁知道如何禁用这些日志?

谢谢:)

0 个答案:

没有答案