Last active
August 29, 2015 14:19
-
-
Save rjnienaber/4e2578a2386b3a38df33 to your computer and use it in GitHub Desktop.
Enable http logging for http_client (JRuby)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# A sample Gemfile | |
source "https://rubygems.org" | |
gem "jruby-httpclient", require: 'http_client' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[DEBUG] SingleClientConnManager - Get connection for route HttpRoute[{}->http://httpbin.org:80] | |
[DEBUG] DefaultClientConnectionOperator - Connecting to httpbin.org/54.175.219.8:80 | |
[DEBUG] RequestAddCookies - CookieSpec selected: best-match | |
[DEBUG] RequestAuthCache - Auth cache not set in the context | |
[DEBUG] DefaultHttpClient - Attempt 1 to execute request | |
[DEBUG] DefaultClientConnection - Sending request: GET /get? HTTP/1.1 | |
[DEBUG] wire - >> "GET /get? HTTP/1.1[\r][\n]" | |
[DEBUG] wire - >> "Host: httpbin.org:80[\r][\n]" | |
[DEBUG] wire - >> "Connection: Keep-Alive[\r][\n]" | |
[DEBUG] wire - >> "User-Agent: Apache-HttpClient/4.1.1 (java 1.5)[\r][\n]" | |
[DEBUG] wire - >> "[\r][\n]" | |
[DEBUG] headers - >> GET /get? HTTP/1.1 | |
[DEBUG] headers - >> Host: httpbin.org:80 | |
[DEBUG] headers - >> Connection: Keep-Alive | |
[DEBUG] headers - >> User-Agent: Apache-HttpClient/4.1.1 (java 1.5) | |
[DEBUG] wire - << "HTTP/1.1 200 OK[\r][\n]" | |
[DEBUG] wire - << "Server: nginx[\r][\n]" | |
[DEBUG] wire - << "Date: Tue, 14 Apr 2015 17:46:03 GMT[\r][\n]" | |
[DEBUG] wire - << "Content-Type: application/json[\r][\n]" | |
[DEBUG] wire - << "Content-Length: 187[\r][\n]" | |
[DEBUG] wire - << "Connection: keep-alive[\r][\n]" | |
[DEBUG] wire - << "Access-Control-Allow-Origin: *[\r][\n]" | |
[DEBUG] wire - << "Access-Control-Allow-Credentials: true[\r][\n]" | |
[DEBUG] wire - << "[\r][\n]" | |
[DEBUG] DefaultClientConnection - Receiving response: HTTP/1.1 200 OK | |
[DEBUG] headers - << HTTP/1.1 200 OK | |
[DEBUG] headers - << Server: nginx | |
[DEBUG] headers - << Date: Tue, 14 Apr 2015 17:46:03 GMT | |
[DEBUG] headers - << Content-Type: application/json | |
[DEBUG] headers - << Content-Length: 187 | |
[DEBUG] headers - << Connection: keep-alive | |
[DEBUG] headers - << Access-Control-Allow-Origin: * | |
[DEBUG] headers - << Access-Control-Allow-Credentials: true | |
[DEBUG] DefaultHttpClient - Connection can be kept alive indefinitely | |
[DEBUG] wire - << "{[\n]" | |
[DEBUG] wire - << " "args": {}, [\n]" | |
[DEBUG] wire - << " "headers": {[\n]" | |
[DEBUG] wire - << " "Host": "httpbin.org", [\n]" | |
[DEBUG] wire - << " "User-Agent": "Apache-HttpClient/4.1.1 (java 1.5)"[\n]" | |
[DEBUG] wire - << " }, [\n]" | |
[DEBUG] wire - << " "origin": "31.221.100.54", [\n]" | |
[DEBUG] wire - << " "url": "http://httpbin.org/get"[\n]" | |
[DEBUG] wire - << "}[\n]" | |
[DEBUG] SingleClientConnManager - Releasing connection org.apache.http.impl.conn.SingleClientConnManager$ConnAdapter@78890f30 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'bundler' | |
Bundler.require(:default) | |
java_import java.lang.System | |
System.set_property("org.apache.commons.logging.Log", "org.apache.commons.logging.impl.SimpleLog"); | |
System.set_property("org.apache.commons.logging.simplelog.log.org.apache.http", "DEBUG"); | |
client = HTTP::Client.new(:default_host => "http://httpbin.org/get") | |
client.get("/get") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment