production.log is always empty

Hey all,

I can't help notice that while development.log always updates,
production.log is completely empty. There's no runtime errors currently
locally or on server. But in both cases, production.log is empty.

I tried solutions found on google, including the following:

• add config.log_level = :info to config/environments/production.rb
• uncomment config.log_level = :debug in
config/environments/production.rb

But that didn't do anything.

Also, speaking of production and development, why should you use both a
production and development database (e.g. database_development,
database_production) when both will contain the same fields? It seems
like duplicate work.

Thanks for response.

You don't mention what platform you're running on, but if it's *nix, I
would be inclined to check permissions. Does the account running the
application have rights to write to the log folder and production.log
file.
Try deleting the file that's there and restarting the application to
see if it gets recreated.

John Merlino wrote in post #965993:

I can't help notice that while development.log always updates,
production.log is completely empty. There's no runtime errors currently
locally or on server. But in both cases, production.log is empty.

Are you sure your server is actually running in the production
environment (RAILS_ENV=production)?

Also, speaking of production and development, why should you use both a
production and development database (e.g. database_development,
database_production) when both will contain the same fields? It seems
like duplicate work.

There should be three databases at least. Development, test &
production. It's not duplicate work migrations take care of moving the
schema forward (at least for ActiveRecord).

Having separate development and production database allow you to
experiment in the development database without affecting production
data. The test database is there solely to support automated unit
testing. This database should be emptied between each test case. You
wouldn't want that to happen to the development or certainly not the
production database.

Are you sure your server is actually running in the production
environment (RAILS_ENV=production)?

I am not sure.

But on server, in:
/etc/httpd/conf/rails.conf file

I have:

<VirtualHost *:80>
  DocumentRoot /var/www/apps/human/public
  <Directory /var/www/apps/human/public>
  allow from all
  Options +Indexes
  </Directory>
  ServerName www.humandiet.net
  RailsEnv production
</VirtualHost>

So this appears to be default by passenger.

In config/environment.rb I have this:
ENV['RAILS_ENV'] ||= 'production'

And my server has been restarted hundreds of times since those changes
were made.

Thanks for response.

When you believe that you are running in production mode is
development.log still getting written to? Each entry has a time stamp
so it is easy to tell. If so then either you are actually running in
development mode for some reason or the wrong log is getting written
to.

Another thing you can do to check is in one of your views display the
value of ENV['RAILS_ENV'].

Colin

When I try ENV['RAILS_ENV'], it correctly says "production". But the
production log is still not written to.

You don't mention what platform you're running on, but if it's *nix, I
would be inclined to check permissions. Does the account running the
application have rights to write to the log folder and production.log
file.

Using macbook pro, and users do have permission to read and write to the
file. So I don't think that could be problem.

When I try ENV['RAILS_ENV'], it correctly says "production". But the
production log is still not written to.

Open a console in production mode and

RAILS_DEFAULT_LOGGER.info("what the hey")

=> "2010-12-03-18:00:00 INFO what the hey\n"

and then check the log file(s). Does that show up anywhere?

Open a console in production mode and

RAILS_DEFAULT_LOGGER.info("what the hey")

=> "2010-12-03-18:00:00 INFO what the hey\n"

and then check the log file(s). Does that show up anywhere?

I try it and still the production.log is empty:

[root@Proxima MARKT]# script/console production
Loading production environment (Rails 2.3.8)

RAILS_DEFAULT_LOGGER.info("what the hey")

=> "what the hey\n"

exit

[root@Proxima MARKT]# ls
app config db doc IDENTIFIED lib log public Rakefile README
script test tmp vendor
[root@Proxima MARKT]# cd log
[root@Proxima log]# ls
development.log production.log server.log test.log
[root@Proxima log]# nano production.log

There should be three databases at least. Development, test &
production. It's not duplicate work migrations take care of moving the
schema forward (at least for ActiveRecord).

I tried the migration with it:

MacBook-Pro:MARKT jmerlino$ rake db:migrate RAILS_ENV=production
(in /Users/jmerlino/MARKT )
rake aborted!
Access denied for user 'root'@'localhost' (using password: YES)

This happens despite having a real simple password of only letters.

My database.yml file has this for production:

production:
  adapter: mysql
  encoding: utf8
  database: website_production
  host: localhost
  username: root
  password: mymysql

Also, I can access mysql via command line:

mysql -u root website_development --password=mymysql
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 581
Server version: 5.1.40 MySQL Community Server (GPL)

Type 'help;' or '\h' for help. Type '\c' to clear the current input
statement.

So I'm not sure why I get rake aborted error.

Thanks for response.

and then check the log file(s). Does that show up anywhere?

I try it and still the production.log is empty:

Not the question -- did it show up *anywhere*? In another log?

[root@Proxima log]# ls

I find it useful to
  alias newest='ls -alFGht | head -10'

Just a suggestion.

Wait, what? You previously said:

[root@Proxima MARKT]# script/console production

You're definitely making this more complicated by switching back and
forth between yourself and root -- an unnecessary variable.

Did you delete the production.log? Did it get recreated when you
started the application?

Please remember to quote the previous message so that your reply has
some sort of context. Insert your reply into previous email. Thanks.

When I try ENV['RAILS_ENV'], it correctly says "production". But the
production log is still not written to.

Inserting your reply inline also makes it more likely that all issues
in previous post will be addressed. You have said that the production
log is not written to but you have not answered my previous question:
When you believe that you are running in production mode is
development.log still getting written to?
Or any other log for that matter.

Colin

Inserting your reply inline also makes it more likely that all issues
in previous post will be addressed. You have said that the production
log is not written to but you have not answered my previous question:
When you believe that you are running in production mode is
development.log still getting written to?
Or any other log for that matter.

Colin

No other log is getting written to. The only time a log is written to is
the development log when I am running the app locally:

Processing DashboardsController#index (for 127.0.0.1 at 2010-12-06
09:30:04) [GET]
  [4;36;1mDashboard Load (87.7ms)[0m [0;1mSELECT * FROM `dashboards`
[0m
Rendering template within layouts/application
Rendering dashboards/index
  [4;35;1mDashboard Columns (28.2ms)[0m [0mSHOW FIELDS FROM
`dashboards`[0m
  [4;36;1mUser Columns (3.9ms)[0m [0;1mSHOW FIELDS FROM `users`[0m
Completed in 781ms (View: 631, DB: 121) | 200 OK [http://localhost/]

Did you delete the production.log? Did it get recreated when you
started the application?

I'm not sure exactly what you mean, but this is what I tried. In
textmate:

• I deleted production.log
• Then restarted server locally

No file was recreated.

Actually after deleting it, it is recreated with this:

# Logfile created on Mon Dec 06 10:19:07 -0500 2010

But nothing else.

Actually after deleting it, it is recreated with this:

# Logfile created on Mon Dec 06 10:19:07 -0500 2010

But nothing else.

OK, instead of my original suggestion using logger:

Open a console in production mode and

RAILS_DEFAULT_LOGGER.info("what the hey")

instead try a simple `puts "-- hey, I'm talking to you"` and see if that
shows up (again, anywhere, not just in the production log).

Also, what's the console output of

RAILS_DEFAULT_LOGGER