sam / harbor

Harbor is a Ruby Web Framework.
https://github.com/sam/harbor
MIT License
3 stars 6 forks source link

"harbor server" makes Rack / WEBrick output a lot of logging #72

Closed fgrehm closed 12 years ago

fgrehm commented 12 years ago

Apparently both Rack::CommonLogger middleware and WEBrick are issuing logging information and WEBrick complains when we send a zero sized response body (which happens when some content is cached like assets and a 304 is returned):

$ bundle exec harbor server
WARNING: Locales are not fully supported on MRI yet
[2012-04-30 00:24:36] INFO  WEBrick 1.3.1
[2012-04-30 00:24:36] INFO  ruby 1.9.3 (2012-02-16) [x86_64-linux]
[2012-04-30 00:24:36] WARN  TCPServer Error: Address already in use - bind(2)
[2012-04-30 00:24:36] INFO  WEBrick::HTTPServer#start: pid=30657 port=9292
127.0.0.1 - - [30/Apr/2012 00:24:39] "GET / HTTP/1.1" 200 3328 0.0416
localhost - - [30/Apr/2012:00:24:39 BRT] "GET / HTTP/1.1" 200 3328
- -> /
127.0.0.1 - - [30/Apr/2012 00:24:39] "GET /assets/stylesheets/bootstrap.min.css HTTP/1.1" 304 - 0.0008
[2012-04-30 00:24:39] WARN  Could not determine content-length of response body. Set content-length of the response or set Response#chunked = true
localhost - - [30/Apr/2012:00:24:39 BRT] "GET /assets/stylesheets/bootstrap.min.css HTTP/1.1" 304 0
http://localhost:9292/ -> /assets/stylesheets/bootstrap.min.css
127.0.0.1 - - [30/Apr/2012 00:24:39] "GET /assets/stylesheets/bootstrap-responsive.min.css HTTP/1.1" 304 - 0.0007
[2012-04-30 00:24:39] WARN  Could not determine content-length of response body. Set content-length of the response or set Response#chunked = true
localhost - - [30/Apr/2012:00:24:39 BRT] "GET /assets/stylesheets/bootstrap-responsive.min.css HTTP/1.1" 304 0
http://localhost:9292/ -> /assets/stylesheets/bootstrap-responsive.min.css
127.0.0.1 - - [30/Apr/2012 00:24:39] "GET /assets/stylesheets/closet.css HTTP/1.1" 304 - 0.0007
[2012-04-30 00:24:39] WARN  Could not determine content-length of response body. Set content-length of the response or set Response#chunked = true
localhost - - [30/Apr/2012:00:24:39 BRT] "GET /assets/stylesheets/closet.css HTTP/1.1" 304 0
http://localhost:9292/ -> /assets/stylesheets/closet.css
127.0.0.1 - - [30/Apr/2012 00:24:39] "GET /assets/javascripts/jquery-ui-1.8.19.custom.min.js HTTP/1.1" 304 - 0.0007
[2012-04-30 00:24:39] WARN  Could not determine content-length of response body. Set content-length of the response or set Response#chunked = true
localhost - - [30/Apr/2012:00:24:39 BRT] "GET /assets/javascripts/jquery-ui-1.8.19.custom.min.js HTTP/1.1" 304 0
http://localhost:9292/ -> /assets/javascripts/jquery-ui-1.8.19.custom.min.js
127.0.0.1 - - [30/Apr/2012 00:24:39] "GET /assets/javascripts/jquery-1.7.2.min.js HTTP/1.1" 304 - 0.0007
[2012-04-30 00:24:39] WARN  Could not determine content-length of response body. Set content-length of the response or set Response#chunked = true
localhost - - [30/Apr/2012:00:24:39 BRT] "GET /assets/javascripts/jquery-1.7.2.min.js HTTP/1.1" 304 0
http://localhost:9292/ -> /assets/javascripts/jquery-1.7.2.min.js

The WEBrick WARN is a known issue on MRI 1.9.3, but the duplicated log messages is probably something we can avoid.

The weird thing is that running just bundle exec rackup does not issue those duplicated messages:

$ bundle exec rackup
WARNING: Locales are not fully supported on MRI yet
[2012-04-30 00:37:11] INFO  WEBrick 1.3.1
[2012-04-30 00:37:11] INFO  ruby 1.9.3 (2012-02-16) [x86_64-linux]
[2012-04-30 00:37:11] INFO  WEBrick::HTTPServer#start: pid=31557 port=9292
127.0.0.1 - - [30/Apr/2012 00:37:13] "GET / HTTP/1.1" 200 3328 0.0254
127.0.0.1 - - [30/Apr/2012 00:37:13] "GET /assets/stylesheets/bootstrap.min.css HTTP/1.1" 200 81939 0.0244
127.0.0.1 - - [30/Apr/2012 00:37:13] "GET /assets/stylesheets/bootstrap-responsive.min.css HTTP/1.1" 200 10518 0.0016
127.0.0.1 - - [30/Apr/2012 00:37:13] "GET /assets/stylesheets/closet.css HTTP/1.1" 200 174 0.0011
127.0.0.1 - - [30/Apr/2012 00:37:13] "GET /assets/javascripts/jquery-ui-1.8.19.custom.min.js HTTP/1.1" 200 45969 0.0244
127.0.0.1 - - [30/Apr/2012 00:37:13] "GET /assets/javascripts/jquery-1.7.2.min.js HTTP/1.1" 200 94840 0.0231
127.0.0.1 - - [30/Apr/2012 00:37:13] "GET /assets/images/top.png HTTP/1.1" 200 142989 0.0189
127.0.0.1 - - [30/Apr/2012 00:37:13] "GET /assets/images/skirt.png HTTP/1.1" 200 394432 0.0861
sam commented 12 years ago

Looks like two servers are trying to start in the first example. That might explain the dupes.