Joern Akkermann
Joern Akkermann

Reputation: 3622

Rails: made rake log:clear then Rails stopped logging

I have cleared my Rails app's log file with rake log:clear.

Then Rails stopped logging the errors.... the Logfile is still empty, even though errors appeared again.

Any help?

Greets, Joern.

Upvotes: 1

Views: 3180

Answers (2)

nembleton
nembleton

Reputation: 2502

In the end, what's, to me, the final procedure is:

  1. chown the log files to your web user
  2. chmod 0666 to the log files
  3. Restart your rails setup which can be:
    1. Passenger -> Restart nginx/apache/proxy ( service nginx/apache2 restart would suffice )
    2. WEBRick/Rack -> Restart these one
    3. Unicorn -> kill -9 unicorn and launch again ( -HUP or -USR2 don't seem to reload filesystem changes properly )

Upvotes: 0

user155104
user155104

Reputation:

It might be possible that you changed the permissions on the log file by mistake, and the user you're running your webapp server with is not the same as the one that owns the logfile.

In any case, if you run 'script/console', it should warn you if it can't write to the log file. If it doesn't, then a logfile has gotta be being written somewhere.

This is the warning the console will print if it can't write to the logfile for some reason:

Rails Error: Unable to access log file. Please ensure that /Users/mtoledo/Projects/stackoverflow/log/development.log exists and is chmod 0666. The log level has been raised to WARN and the output directed to STDERR until the problem is fixed. Loading development environment (Rails 3.0.0.beta4)

Also, keep in mind it will be writing to 'development.log' unless you're changing your environment, but since you said it was writing to it before I assume that's not the issue

Upvotes: 1

Related Questions