66

A member of my team is developing a Rails app on Windows XP. We are finding that when we run the app, either launching it within NetBeans or by opening a console and calling script/server, the Rails development log does not scroll by. There is only the Webrick startup message. The app is definitely running, but when we hit various pages in the browser we aren't seeing any logging output.

When I look at the identical app on my OS X system, logging output works as expected.

I did make sure that it's running in Rails "development" environment.

Any ideas why logging would be suppressed?

Are there config params for the environment.rb file that would affect it?

Edward Castano
  • 617
  • 2
  • 8
  • 14
Ethan
  • 57,819
  • 63
  • 187
  • 237

10 Answers10

131

Look in the log/ directory - there should be a development.log. I bet your output is there.

If it's not, make sure that directory is writable.

For how to see it while you're running: if you have git bash installed, or some other shell such as cygwin, then you can open a shell and do tail -f log/development.log which will scroll the log as it gets stuff appended to it.

Sarah Mei
  • 18,154
  • 5
  • 45
  • 45
  • Hey Sarah! Thanks, yeah, I set him up with a Git Bash console window running tail -f. However, it puzzles me that Webrick is not sending all that Rails logging output to stdout. I thought that was supposed to happen by default. – Ethan Jun 19 '09 at 00:09
  • Yeah, that is odd. When I run ruby script/server in a directory (in git bash, on XP Pro) I see the output. I tried it with and without "ruby", and even in cmd.exe. Each time it waited until it had a window-full of output to output anything, though. What version of Rails/Ruby/WEBrick? I'm on 2.3.2/1.8.6/1.3.1. – Sarah Mei Jun 19 '09 at 05:23
  • 2.3.2/1.8.6/not sure about WEBrick -- I don't have access to that XP machine at the moment. – Ethan Jun 19 '09 at 14:53
  • IN PRODUCTION: This is very usefull in production mode- when you run server in development mode, not as daemon, in linux, you can preview logs live in console by default. Problem is when you have app on server, on production: with this command bug-tracking is much more easier – Outside_Box Oct 17 '16 at 12:35
9

The Rails Configuration documentation suggests that you may have log_level set to something other than :debug in your configuration.

There is also an alternative place to view the requests: the log/development.log file in your Rails app. If nothing is written there, then your problem must be in configuration. On a *nix system I would run:

$ tail -f log/development.log

And watch the requests run by. They tell me that there is a Windows version of tail.

Andres Jaan Tack
  • 22,566
  • 11
  • 59
  • 78
6
less -R log/development.log

I just started to use this.

Tu H.
  • 496
  • 6
  • 12
3

I always use log/development.log to look at the logs. Just tail -f it using cygwin or something.

Maybe your Windows environment is using WEBrick and the OS X environment is using Mongrel or other webserver. I've noticed that with some webservers the logging output is (also) written directly into the shell and with others is written only to the log files.

Thiago Arrais
  • 33,360
  • 7
  • 30
  • 34
3

Try this, to get development log:

tail -f log/development.log

Make sure that you are in the application path.

Outside_Box
  • 447
  • 1
  • 4
  • 16
Rahul2692
  • 334
  • 1
  • 10
3

You can see the run-time logs using the below command:

tail -f log/development.log

Also if you just want first or last number of lines from the logs you can just get those using below command (first / last 100 lines from logs):

For example:

First 100 lines:

head -n 100 log/development.log 

Last 100 lines:

tail -n 100 log/development.log

Thanks!

Richard de Wit
  • 7,102
  • 7
  • 44
  • 54
Sumit Munot
  • 3,748
  • 1
  • 32
  • 51
2

Netbeans seems to stop displaying the dev log in the console window when the dev log gets too large. At least that was my experience.

srboisvert
  • 12,679
  • 15
  • 63
  • 87
1

Without digging into the source for Webrick, I suspect that the amount of information displayed is by default not large. Are you sure you're running Webrick on OSX and not Mongrel?

In fact, is there a particular reason for continuing to use Webrick at all? Before the advent of Phusion Passenger, Mongrel had become the de facto front-end server of choice, and it works just fine on Windows. If you install it (gem install mongrel) then Rails will use it by default.

In my development environment, running Webrick (after I'd figured out how - it's been a long time) I got very brief output: just a record of the "GET" request. Switching to Mongrel, I got the full works: request, parameters, SQL, timings etc.

Mike Woodhouse
  • 51,832
  • 12
  • 88
  • 127
  • Thanks. That is really helpful. Yes, on my OS X machine running Mongrel. My coworker's XP system is running Webrick. I'll try installing Mongrel there. – Ethan Jun 19 '09 at 14:50
1

I use tail with grep

tail -f log/development.log | grep Started -A 1

Works beautifully.

Hristo
  • 859
  • 1
  • 8
  • 14
0

You can try this command

$ tail -f development.log


$ tail -f log/development.log
Foram
  • 483
  • 5
  • 12