# \[ANN\] Mongrel Console 0.1 -- script/console meets mongrel

**URL:** <https://www.ruby-forum.com/t/ann-mongrel-console-0-1-script-console-meets-mongrel/55276>\
**Category:** Rails\
**Created:** [March 18, 2006, 10:19pm UTC](https://www.ruby-forum.com/t/ann-mongrel-console-0-1-script-console-meets-mongrel/55276 "2006-03-18T22:19:02Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Zed\_S](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/z/da6949/32.png) [@Zed\_S](https://www.ruby-forum.com/u/Zed_S)\
**Post date:** [March 18, 2006, 10:19pm UTC](https://www.ruby-forum.com/t/ann-mongrel-console-0-1-script-console-meets-mongrel/55276/1 "2006-03-18T22:19:02Z")

</div>

This is a super quick announcement for a new Mongrel plugin called  
mongrel\_console. It was inspired by a request from Tobias Lütke who wanted  
to tail out logs while Mongrel was running.

What mongrel\_console does is combine the Rails script/console with  
Mongrel  
so that you can control a mongrel server while using script/console.  
Sounds  
weird but it’s quite awesome for development hacking. You get to start,  
stop, and reload mongrel and rails while also munging with your AR  
models  
and running other Rails code.

INSTALL

You can install it via:

gem install mongrel\_console  
–source=[http://mongrel.rubyforge.org/releases/](http://mongrel.rubyforge.org/releases/)

Then you run it with:

$ cd myrailsapp  
$ mongrel\_rails console

USAGE

You then get an IRB prompt but that you can use like script/console.  
But,  
now there’s a bunch of new commands you can use to control Mongrel:

- start – Starts up a Mongrel instance and runs your Rails app in the  
background. Accepts an option hash. See status to find out what’s  
available.
- stop – Stops the currently running Mongrel instance.
- restart – Stops then starts using your previous options. If you want  
to  
change options then manually start and stop with new options.
- status – Tells you if Mongrel is running and then dumps the options  
Hash.
- trace – Tells Mongrel to dump all of the request and response headers  
to  
log/mongrel.log. Incredibly useful if you think Mongrel is broken for  
some  
reason or if you suspect you’ve got a bad header some place.
- tail – Let’s you tail a file out (doesn’t go back to the prompt). By  
default it tails the log for your environment (log/development.log).  
Very  
useful with trace (try tail “log/mongrel.log”).

EXAMPLE

Here’s me using it during development:

Loading development environment.  
Starting console. Mongrel Commands: start, stop, reload, restart,  
status,  
trace, tail  
irb(main):001:0\> start  
Mongrel running in development mode on 0.0.0.0:3000.  
=\> nil  
irb(main):002:0\> trace  
Tracing mongrel requests and responses to log/mongrel.log  
=\> nil  
irb(main):003:0\> tail “log/mongrel.log”  
Tailing log/mongrel.log. CTRL-C to stop it.  
…  
^C=\> nil  
irb(main):004:0\> reload  
Reloading rails…  
Done reloading rails.  
=\> nil  
irb(main):005:0\> restart  
Server stopped. Exiting.  
Shutdown waiting for 20 requests  
Mongrel running in development mode on 0.0.0.0:3000.  
=\> nil  
irb(main):006:0\> status  
Mongrel running with:

- mime:
- docroot: public
- server: #Mongrel::HttpServer:0x253441c
- tracing: true
- rails: #RailsHandler:0x25344d0
- host: 0.0.0.0
- port: 3000  
=\> nil  
irb(main):007:0\> stop  
Server stopped. Exiting.  
Shutdown waiting for 20 requests  
=\> nil  
irb(main):008:0\> status  
Mongrel not running.  
=\> nil  
irb(main):009:0\> start :port =\> 4000  
Mongrel running in development mode on 0.0.0.0:4000.  
=\> nil  
irb(main):010:0\> status  
Mongrel running with:
- mime:
- docroot: public
- server: #Mongrel::HttpServer:0x26d4fb0
- tracing: true
- rails: #RailsHandler:0x26d5154
- host: 0.0.0.0
- port: 4000  
=\> nil

Win32 people might find the tail command doesn’t work.

Enjoy! Let me know what you think.

Zed A. Shaw

> **[Zed A. shaw](https://zedshaw.com/)**
>
> Personal essays and writings by Zed A. Shaw.

---

<div class="post-metadata">

**Author:** ![Zed\_S](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/z/da6949/32.png) [@Zed\_S](https://www.ruby-forum.com/u/Zed_S)\
**Post date:** [March 18, 2006, 11:10pm UTC](https://www.ruby-forum.com/t/ann-mongrel-console-0-1-script-console-meets-mongrel/55276/2 "2006-03-18T23:10:43Z")

</div>

Awesome! I love “reload”. No need to CTRL-C; ; ;  
anymore

---

<div class="post-metadata">

**Author:** ![Zed\_S](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/z/da6949/32.png) [@Zed\_S](https://www.ruby-forum.com/u/Zed_S)\
**Post date:** [March 18, 2006, 11:22pm UTC](https://www.ruby-forum.com/t/ann-mongrel-console-0-1-script-console-meets-mongrel/55276/3 "2006-03-18T23:22:54Z")

</div>

A couple of little weird bugs people should know about:

1. I made a mistake in the tracing, so uninstall and then reinstall the  
mongrel\_console gem to get a fix.
2. When you run it with the console going it is very sloooowwwwwww.  
For  
some weird reason you just need to tail a log and it speeds back up.

Have fun.

Zed A. Shaw

> **[Zed A. shaw](https://zedshaw.com/)**
>
> Personal essays and writings by Zed A. Shaw.

---

<div class="post-metadata">

**Author:** ![Zed\_S](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/z/da6949/32.png) [@Zed\_S](https://www.ruby-forum.com/u/Zed_S)\
**Post date:** [June 23, 2006, 7:03am UTC](https://www.ruby-forum.com/t/ann-mongrel-console-0-1-script-console-meets-mongrel/55276/4 "2006-06-23T07:03:21Z")

</div>

Hey Zed –

root# mongrel\_rails console  
Cannot run the console script: uninitialized constant RailsConfigurator

Any idea on that error msg?

Thanks

---

<div class="post-metadata">

**Author:** ![Zed\_S](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/z/da6949/32.png) [@Zed\_S](https://www.ruby-forum.com/u/Zed_S)\
**Post date:** [June 23, 2006, 9:20am UTC](https://www.ruby-forum.com/t/ann-mongrel-console-0-1-script-console-meets-mongrel/55276/5 "2006-06-23T09:20:25Z")

</div>

Adam R. wrote:

> Hey Zed –
> 
> root# mongrel\_rails console  
> Cannot run the console script: uninitialized constant RailsConfigurator
> 
> Any idea on that error msg?
> 
> Thanks

It would be nice for mongrel to have the tailing behavior like  
script/server does when you run it in non daemon mode. This mongrel  
console is nice though.
