Jruby-rack logging example

I have the simplest of rack applications

config.ru

run Proc.new {|env| [200, {“Content-Type” => “text/html”}, [“Hello
Rack!”]]}

I’m using warbler master and have managed to create an executable war
file of the above using the new Jetty embedded server.

What I’m having an issue getting working is request logging.

I can add -Dorg.eclipse.jetty.LEVEL=DEBUG to the java command but that
outputs a lot more information that I’m after. What I’m really after
is the output from Rack::CommonLogger to a text file (or stdout) that
I can specify (either at compile or run time).

Ideally I’d love an example I can run and unpick.

I’ve noted the slf4j, servlet_context and log4j entries on the
jruby-rack read me, but finding information to get over the
“configuration is left up to you” part is proving troublesome.

Any help much appreciated.

Gareth


Gareth Rushgrove
Web Geek

morethanseven.net
garethrushgrove.com

What happens if you put Rack::CommonLogger in config.ru?

require ‘rack/commonlogger’
use Rack::CommonLogger

The settings you’re speaking of is “jruby.rack.logging”, which you can
specify on the command-line with “-Djruby.rack.logging=…”. See
GitHub - jruby/jruby-rack: Rack for JRuby and Java appservers README (section Logging) for
details.

/Nick
On Sun, Apr 1, 2012 at 3:02 PM, gareth rushgrove

On 1 April 2012 22:05, Nick S. [email protected] wrote:

What happens if you put Rack::CommonLogger in config.ru?

require ‘rack/commonlogger’
use Rack::CommonLogger

I could swear I tried that but obviously not with logging = “sdtout”.
That works perfectly. Cheers.

The settings you’re speaking of is “jruby.rack.logging”, which you can
specify on the command-line with “-Djruby.rack.logging=…”.

Ah nice, so -D allows specifying all of the Warbler::Config options?
That’s handy.

Thanks for the help

Gareth

run Proc.new {|env| [200, {“Content-Type” => “text/html”}, [“Hello Rack!”]]}


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email


Gareth Rushgrove
Web Geek

morethanseven.net
garethrushgrove.com