Question about WEBrick console logging

I'm writing a WEBrick server that I want to output some status
information to the console. However, all the *other* stuff that's
getting output makes my information hard to see. Even after adding
to the server configuration what I *thought* was supposed to make
it only output for fatal errors, I still get the line with my hostname,
the current time, and the request string.

How can I make this go away?

-Morgan.

"Ginger ale. And leave the bottle."

···

--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.344 / Virus Database: 267.12.1/136 - Release Date: 10/15/2005

Morgan wrote:

I'm writing a WEBrick server that I want to output some status
information to the console. However, all the *other* stuff that's
getting output makes my information hard to see. Even after adding
to the server configuration what I *thought* was supposed to make
it only output for fatal errors, I still get the line with my hostname,
the current time, and the request string.

How can I make this go away?

The *other* stuff is the access log. You can suppress it by assigning an empty set of outputs:

  server = WEBrick::HTTPServer.new( :AccessLog => )

Or you could send it to an access log file:

  server = WEBrick::HTTPServer.new(
    :AccessLog => [[Logger.new('access.log'), AccessLog::COMMON_LOG_FORMAT]] )

Whatever you choose I'm sure will work out for the best.

_why

Add this option to the hash you are passing to your server:

    :AccessLog =>

The things you see are logged by the access log. By passing an empty
array, nothing is logged. If you pass nil, the default is used:

    unless @config[:AccessLog]
        @config[:AccessLog] = [
          [ $stderr, AccessLog::COMMON_LOG_FORMAT ],
          [ $stderr, AccessLog::REFERER_LOG_FORMAT ]
        ]
    end

It took me some digging to figure this out...

Ryan

···

On 10/18/05, Morgan <taria@the-arc.net> wrote:

I'm writing a WEBrick server that I want to output some status
information to the console. However, all the *other* stuff that's
getting output makes my information hard to see. Even after adding
to the server configuration what I *thought* was supposed to make
it only output for fatal errors, I still get the line with my hostname,
the current time, and the request string.

How can I make this go away?