[Nitro] Webrick log

Kirk Haines wyhaines at gmail.com
Mon Feb 12 17:08:59 EST 2007

On 2/12/07, George Moschovitis <george.moschovitis at gmail.com> wrote:

> anyone knows how I can get rit of the following Webrick log crap?
> [2007-02-12 22:34:34] INFO  WEBrick 1.3.1
> [2007-02-12 22:34:34] INFO  ruby 1.8.4 (2005-12-24) [i486-linux]
> [2007-02-12 22:34:34] INFO  WEBrick::HTTPServer#start: pid=13118 port=9000

Webrick lets you control the logging destination.

When you create the webrick server instance, pass it a couple of
parameters, :Logger and :AccessLog that provide an alternative
destination for the webrick logging.

    @server = Iowa::WEBrick::HTTPServer.new(
      :Port => @config[Csocket][Cport],
      :BindAddress => @config[Csocket][Chostname],
      :DocumentRoot => Iowa.app.class.docroot,
      :Logger => swallow_logs,
      :AccessLog => swallow_logs,
      :CGIInterpreter => ruby)

That's how my webrick handler does it.  swallow_logs is an instance of
a "logger" that does nothing but eat whatever it is fed.

Kirk Haines

More information about the Nitro-general mailing list