Saturday, February 03, 2007

[PLUGIN RELEASE] - Browser Logger - Stop tailing your logs!


We got a little tired of tailing our logs all day--especially remotely. I threw together a plugin (with enhancements from Todd and Aaron) that allows you to retrieve the logs for your request on-demand.

Rubyforge project

From the README:

BrowserLogger
================

Appends just this request's logs to the end of the response. It's a little more convenient than tailing a log, especially when you're not logged in. For now, it's 'always on.' Feel free to modify init.rb to incorporate whatever on/off switch you want.

You'll get all the database logs as well, complete with rudimentary color coding and JS filtering.

This will always gather ALL logging actions, regardless of configured log level--helpful when you're in prod mode and want to debug a request without changing the log level and bouncing.

Usage:

Install plugin:

./script/plugin install svn://rubyforge.org/var/svn/browser-logger

Fire up your rails app, make a request with log! or logs! appended as a query param.

e.g.:

http://localhost/pets/show/1
http://localhost/pets/show/1?log!


As a footnote, this particular process hook is extremely useful for hooking very deeply for actions such as profiling, logging, response filtering, etc.

7 comments:

Rich said...

Brilliant....Thank You!

Unknown said...

nice! however...

How do I secure this (against session[:user])? I don't want the Great Washed Masses peeking at my log.

Also, what happens if the log has a butt-load of irrelevant hits in it?

Aaron Batalion said...

Depending on how paranoid you are, you can modify the init.rb to check if in production mode and turn it off, or if you're really worried, a capistrano/deploy task to delete the directory.

Chris said...

The subversion repository ins not available and hasn't been for that last few days svn://rubyforge.org/var/svn/browser-logger

Chris said...

Is there a location where we can download the files for this plugin? The repository is unavailable.

Thanks
Chris

Val Aleksenko said...

To Chris: The repository seems to be working for me. Anyway I packaged and released it as a zip archive.

Anonymous said...

thanks ur information