Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can we watch the Rails development log?

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?

like image 519
Ethan Avatar asked Jun 18 '09 23:06

Ethan


People also ask

Where can I see rails logs?

In a Rails app, logs are stored under the /log folder. In development mode, the development. log file is used & you see log output on the terminal you're running rails server on.

How do I view rails logger info?

If you want to know the current log level, you can call the Rails. logger. level method. This is useful when you want to log under development or staging without flooding your production log with unnecessary information.

How do I use Rails logger info?

This can be done in one of two ways—first, with configuration. As shown below, we're setting the format specification to show the log message's datetime and message and the program's name. Alternatively, we can also change the format by overriding the logger's format method.

How do I create a log file in rails?

If you want to change all the default logging for that specific model, you can simply use User. logger = Logger. new(STDOUT) or wherever you want to log to. In the same way, ActiveRecord::Base.


2 Answers

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.

like image 57
Sarah Mei Avatar answered Sep 18 '22 07:09

Sarah Mei


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.

like image 35
Andres Jaan Tack Avatar answered Sep 18 '22 07:09

Andres Jaan Tack