How to disable Request information in twitter4j?

How to disable printing request information while using twitter4j

  • I'm trying to test a simple search method in twitter4j. My code is public void searchTweets(Query searchQuery) { QueryResult queryResult = null; try { queryResult = twitter.search(searchQuery); } catch (TwitterException e) { log.error("Unable to search query = {}", searchQuery, e); } } When i test this above code, i'm getting the following output. How should I disable this output which contains request information? - Request: - GET http://search.twitter.com/search.json?q=Sports&since_id=111374710708768768 - OAuth base string: GET&http%3A%2F%2Fsearch.twitter.com%2Fsearch.json&oauth_con sumer_key%3DABk1pJ6bd5LWcf1lsIa9g%26oauth_nonce%3D914173077%26oauth_signature_me thod%3DHMAC-SHA1%26oauth_timestamp%3D1315388678%26oauth_token%3D73081379-KQOkj6E g4uBdUXSzlpvbtdb5OWOLXD3mxVo9nrdRV%26oauth_version%3D1.0%26q%3DSports%26since_id %3D111374710708768768 - OAuth signature: oUszlR4fGxq8JiqXNFf+t6SgXdA= - Authorization: *************************************************************** ******************************************************************************** ******************************************************************************** ************************************************* - X-Twitter-Client-URL: http://twitter4j.org/en/twitter4j-2.2.5-SNAPSHOT(build: 5f9c44cd0e0c1972f8d17653a226b9b6a3392ac2).xml - X-Twitter-Client: Twitter4J - Accept-Encoding: gzip - User-Agent: twitter4j http://twitter4j.org/ /2.2.5-SNAPSHOT(build: 5f9c44cd0e0 c1972f8d17653a226b9b6a3392ac2) - X-Twitter-Client-Version: 2.2.5-SNAPSHOT(build: 5f9c44cd0e0c1972f8d17653a226b9 b6a3392ac2) - Response: - HTTP/1.1 200 OK - Age: 0 - Content-Length: 1107 - Expires: Wed, 07 Sep 2011 09:51:30 GMT - Connection: close - Server: hi - Cache-Control: max-age=15, must-revalidate, max-age=300 - X-Varnish: 513089989 - Vary: Accept-Encoding - Date: Wed, 07 Sep 2011 09:46:30 GMT - Content-Encoding: gzip - Via: 1.1 varnish - Content-Type: application/json;charset=utf-8 - text='Montague Action Cricket: Titans 8 be at Forfeit +10 (10 - 1) http://t.co/2RbMzpK'

  • Answer:

    Add this to log4j.properties: log4j.logger.twitter4j.internal.http=warn

diya at Stack Overflow Visit the source

Was this solution helpful to you?

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.