[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Stopping WEBrick from logging

Alex Young

8/8/2006 6:38:00 PM

Hi all,

I'm doing some local timing of some network code, and I'm using
WEBrick::HTTPProxyServer to mock out the actual network access to reduce
some of the variability.

What I'd like to do is stop the access logging from happening. That is,
I don't want the access logs to fill up stdout or stderr, because
they're used in my code and I want its output to stay clean. I also
don't want the logs going to a string or array in memory, because it'll
fill up and make everything swap endlessly. Ideally, I want the access
logging to just not happen, and I just can't see how to do that.

Any ideas?

--
Alex

5 Answers

Matt Todd

8/8/2006 6:53:00 PM

0

Could you redirect to a StringIO pointed at /dev/null? Without looking
at the WEBrick API, I wouldn't know right off how to change the
destination of the logging messages. That's the best I can help you
for now.

M.T.

Alex Young

8/8/2006 7:00:00 PM

0

Alex Young wrote:
> Hi all,
>
> I'm doing some local timing of some network code, and I'm using
> WEBrick::HTTPProxyServer to mock out the actual network access to reduce
> some of the variability.
>
> What I'd like to do is stop the access logging from happening. That is,
> I don't want the access logs to fill up stdout or stderr, because
> they're used in my code and I want its output to stay clean. I also
> don't want the logs going to a string or array in memory, because it'll
> fill up and make everything swap endlessly. Ideally, I want the access
> logging to just not happen, and I just can't see how to do that.
>
> Any ideas?
>
Ah. It would seem I should read a few more of the docs before posting.

Apparently doing this:

def access_log(*args); end

in the server class does the trick.

Not exactly intuitive, though...

--
Alex

Alex Young

8/8/2006 7:01:00 PM

0

Matt Todd wrote:
> Could you redirect to a StringIO pointed at /dev/null? Without looking
> at the WEBrick API, I wouldn't know right off how to change the
> destination of the logging messages. That's the best I can help you
> for now.
>
> M.T.
>
Thanks... I might try that next time. For now I'm overriding
HTTPProxyServer#access_log.

--
Alex

Jano Svitok

8/8/2006 7:10:00 PM

0

On 8/8/06, Alex Young <alex@blackkettle.org> wrote:
> Hi all,
>
> I'm doing some local timing of some network code, and I'm using
> WEBrick::HTTPProxyServer to mock out the actual network access to reduce
> some of the variability.
>
> What I'd like to do is stop the access logging from happening. That is,
> I don't want the access logs to fill up stdout or stderr, because
> they're used in my code and I want its output to stay clean. I also
> don't want the logs going to a string or array in memory, because it'll
> fill up and make everything swap endlessly. Ideally, I want the access
> logging to just not happen, and I just can't see how to do that.
>
> Any ideas?

in your HTTPServer (or any descendant of GenericServer) write

logger.level = 0

you can do it from the outside as well.

your_server.logger.level = 0

For more details read the sources ;-)

J.

_ G O D _

1/20/2009 1:01:00 AM

0

"Bent Attorney" <x.smiling_tiger@yahoo.com> wrote
news:8d042262-f609-44aa-a27d-7ad1af33171c@z1g2000yqn.googlegroups.com...
>
>
>....sometimes officers of the law are in wack city and try and
>provoke a situation/confrontation. So the 'perp' being not
>the smartest kitty in the litter (LOL) lashes out. ZAP!!!
>BTW the cops at Ruby Ridge acted like pigs, before and after
>the surrender of the Weaver clan.

LOL!!! What a surprise!!!..... N-OOO-T!!!! Attorney
Did you really expect from pigs to act any different?
--
_____________________________________________________

I intend to last long enough to put out of business all COck-suckers
and other beneficiaries of the institutionalized slavery and genocide.

------------------------------------------------------------------------------------------

"The army that will defeat terrorism doesn't wear uniforms, or drive
Humvees, or calls in air-strikes. It doesn't have a high command, or
high security, or a high budget. The army that can defeat terrorism
does battle quietly, clearing minefields and vaccinating children. It
undermines military dictatorships and military lobbyists. It subverts
sweatshops and special interests.Where people feel powerless, it
helps them organize for change, and where people are powerful, it
reminds them of their responsibility." ~~~~ Author Unknown ~~~~
___________________________________________________
--