Blank Log Files - New to RoR - Ubuntu Server 9.10

Hi -

I've got what seems to be a solid installation of Ubuntu Server 9.10
with the latest version of ruby, rails, etc.

I followed the Ubuntu installation guide.

I set up a Virtual Site with Apache.

The Welcome Aboard page shows correctly.

However, when I click "About your application’s environment", I get a
very unhelpful error message that says:
"We're sorry, but something went wrong."

All four log files in my /log directory are 0 bytes.

Any idea how I can get the logs to at least show me what's going on?

Thanks very much,
Justin Schier

All four log files in my /log directory are 0 bytes.

Any idea how I can get the logs to at least show me what's going on?

Sounds like permissions; does the www-data user own the application directory?
   chown -R www-data.www-data my_rails_app

However, when I click "About your application’s environment", I get a
very unhelpful error message that says:
"We're sorry, but something went wrong."

I've found in the past that problems accessing the application after a
fresh install are often DB problems - like I've forgotten to run
migrations or something :wink:
Can you fire up an IRB session and run code? - even something simple
like "User.all"...

Michael,

I didn't know about www-data, but your suggestion still didn't work. I
rebooted the server completely. I still get the blank logs. Also, I
still get the correct Welcome Aboard page, but when I click "About
your application's environment", I still get "We're sorry, but
something went wrong". There's only one installation of rails on the
server, so I know this must be it.

http://testapp1.fuse.sonikserver.com

Apache /etc/apache2/sites-available/default:

---- Default VirtualHost - omitted for this post ----

LoadModule passenger_module /var/lib/gems/1.8/gems/passenger-2.2.11/
ext/apache2/mod_passenger.so
PassengerRoot /var/lib/gems/1.8/gems/passenger-2.2.11
PassengerRuby /usr/bin/ruby1.8

<VirtualHost *:80>
    ServerName testapp1.fuse.sonikserver.com
    DocumentRoot /var/www/testapp1/public
    <Directory /var/www/testapp1/public>
        Allow from all
        Options -MultiViews
    </Directory>
</VirtualHost>

$ cd /var/www
$ ls -l
lrwxrwxrwx 1 www-data www-data 31 2010-03-21 07:55 testapp1 -> /home/
justinschier/www/testapp1

$ cd /home/justinschier
$ ls -l
drwxrwxr-x 3 www-data www-data 4096 2010-03-20 08:02 www

$ cd www
$ ls -l
drwxrwxr-x 13 www-data www-data 4096 2010-03-20 08:02 testapp1

$ cd testapp1/log
$ ls -l
-rwxrwxrwx 1 www-data www-data 0 2010-03-20 08:02 development.log
-rwxrwxrwx 1 www-data www-data 0 2010-03-20 08:02 production.log
-rwxrwxrwx 1 www-data www-data 0 2010-03-20 08:02 server.log
-rwxrwxrwx 1 www-data www-data 0 2010-03-20 08:02 test.log

Trust me, chown -R www-data:www-data testapp1 did work - everything is
owned by www-data www-data

Please help - I'm losing my mind.

Thanks,
Justin

How about trying to put the server in development mode (if necessary diff the production.rb and development.rb files and copy the settings, such as consider_all_requests_local, over to production.rb) so that the error will be printed out to the screen instead of the log?

Remember to put it back afterwards, but that might let you see what it thinks is wrong…

Cheers,

Andy

I'd focus on trying to get the logs populating first... any other
problems are not going to be easier to fix without it - and you might
find that whatever problem is causing the log-files not to get written
might be causing others....

Did you try accessing your models in the console? What was the outcome
to that? You may get a hint that pushes you in the right direction.

Anyway, the idea to change the owner of the files is more general than
specific; I'm assuming your server's using the www-data user to run
the site - if it's a different user, the ownership needs to be
different.
Anything in the Apache error logs?

I just checked a server I have here (Ubuntu 9.04LTS) and the directory
ownership is slightly different to what I said.
I've got it as:
chown -R root.www-data my_rails_app

Also worth checking the permissions of the log folder, and if there's
log files in there, check their perms - delete them if necessary and
see if the app recreates them once all the ownership is set.

Michael,

Thanks SO much for helping me. I still haven't gotten the logs to
populate, even with root:www-data

No luck with your chown -R root:www-data testapp1
If restarted apache: /etc/init.d/apache2 restart
* Restarting web server apache2
... waiting ...done.

My symbolic link:
$ cd /var/www
$ ls -l
lrwxrwxrwx 1 root www-data 31 2010-03-21 07:55 testapp1 -> /home/
justinschier/www/testapp1

My home www folder:
$ cd /home/justinschier
$ ls -l
drwxrwxrwx 3 root www-data 4096 2010-03-20 08:02 www

My testapp1 folder:
$ cd /home/justinschier/www
$ ls -l
drwxrwxrwx 13 root www-data 4096 2010-03-20 08:02 testapp1

My log folder:
$ cd /home/justinschier/www/testapp1
$ ls -l
...
drwxrwxrwx 2 root www-data 4096 2010-03-20 08:02 log
... (everything's the same permissions and ownership as log)

My log files:
-rwxrwxrwx 1 root www-data 1676 2010-03-22 20:58 development.log
-rwxrwxrwx 1 root www-data 0 2010-03-20 08:02 production.log
-rwxrwxrwx 1 root www-data 0 2010-03-20 08:02 server.log
-rwxrwxrwx 1 root www-data 0 2010-03-20 08:02 test.log

I know the development.log is showing now, BUT that's because I tried
running WebBrick. That's why there's something in there.

My /public folder (no .htaccess file):
$ cd /home/justinschier/www/testapp1/public
$ ls -al
drwxrwxrwx 5 root www-data 4096 2010-03-22 08:21 .
drwxrwxrwx 13 root www-data 4096 2010-03-20 08:02 ..
-rwxrwxrwx 1 root www-data 947 2010-03-20 08:02 404.html
-rwxrwxrwx 1 root www-data 930 2010-03-20 08:02 422.html
-rwxrwxrwx 1 root www-data 948 2010-03-20 08:02 500.html
-rwxrwxrwx 1 root www-data 0 2010-03-20 08:02 favicon.ico
drwxrwxrwx 2 root www-data 4096 2010-03-20 08:02 images
-rwxrwxrwx 1 root www-data 7466 2010-03-20 08:02 index.html
drwxrwxrwx 2 root www-data 4096 2010-03-20 08:02 javascripts
-rwxrwxrwx 1 root www-data 204 2010-03-20 08:02 robots.txt
drwxrwxrwx 3 root www-data 4096 2010-03-22 15:30 stylesheets

Still when I run this, the log files don't grow at all:
http://testapp1.fuse.sonikserver.com/
Welcome Aboard Page loads correctly

http://testapp1.fuse.sonikserver.com/rails/info/properties
and I still get "We're sorry, but something went wrong"

Apache has instances running as both root and www-data:
$ ps aux | grep apache2
root 14157 0.0 0.3 141016 8040 ? Ss 12:24 0:00 /usr/
sbin/apache2 -k start
root 14170 0.0 0.0 23192 1888 ? Sl 12:24 0:00 /var/
lib/gems/1.8/gems/passenger-2.2.11/ext/apache2/
ApplicationPoolServerExecutable 0 /var/lib/gems/1.8/gems/
passenger-2.2.11/bin/passenger-spawn-server /usr/bin/ruby1.8 /tmp/
passenger.14157
www-data 14175 0.0 0.2 141492 6036 ? S 12:24 0:00 /usr/
sbin/apache2 -k start
www-data 14176 0.0 0.2 141348 5812 ? S 12:24 0:00 /usr/
sbin/apache2 -k start
www-data 14177 0.0 0.2 141348 5812 ? S 12:24 0:00 /usr/
sbin/apache2 -k start
www-data 14178 0.0 0.2 141476 5796 ? S 12:24 0:00 /usr/
sbin/apache2 -k start
www-data 14179 0.0 0.2 141476 5924 ? S 12:24 0:00 /usr/
sbin/apache2 -k start
www-data 14183 0.0 0.2 141476 5852 ? S 12:24 0:00 /usr/
sbin/apache2 -k start
www-data 14188 0.0 0.2 141016 4692 ? S 12:25 0:00 /usr/
sbin/apache2 -k start
root 14206 0.0 0.0 7340 884 pts/0 S+ 12:27 0:00 grep
apache2

I even got rid of the symbolic link (above) and no change:

$ vi /etc/apache2/sites-available/default

Now reads:

... default part ommitted for this post ....

LoadModule passenger_module /var/lib/gems/1.8/gems/passenger-2.2.11/
ext/apache2/mod_passenger.so
PassengerRoot /var/lib/gems/1.8/gems/passenger-2.2.11
PassengerRuby /usr/bin/ruby1.8

<VirtualHost *:80>
    ServerName testapp1.fuse.sonikserver.com
    DocumentRoot /home/justinschier/www/testapp1/public
    <Directory /home/justinschier/www/testapp1/public>
        Allow from all
        Options -MultiViews
    </Directory>
</VirtualHost>

Man, I am so out of ideas. Anything else you can think of for me to
try?

Thanks again SOOO much. If you have an Amazon wish list, I'm totally
buying you something.

Justin

Justin,

I don't know what you're so impressed with me for... we've not sorted
your problem. And I'm afraid I pretty much out of ideas, I'm afraid
:frowning:

It's bugging me, because I had the *same* issue a couple of weeks ago
(log files not being written to), although my application was working.
But I can't remember what was the thing that fixed it, and I'm not at
home to look to see if I made any notes.

Just looking through your post again; if you delete the log files, do
they get created by Apache? And what does the tail of the Apache log
say?

Michael,

Thanks SO much for helping me. I still haven't gotten the logs to
populate, even with root:www-data

No luck with your chown -R root:www-data testapp1
If restarted apache: /etc/init.d/apache2 restart
* Restarting web server apache2
... waiting ...done.

My symbolic link:
$ cd /var/www
$ ls -l
lrwxrwxrwx 1 root www-data 31 2010-03-21 07:55 testapp1 -> /home/
justinschier/www/testapp1

My home www folder:
$ cd /home/justinschier
$ ls -l
drwxrwxrwx 3 root www-data 4096 2010-03-20 08:02 www

My testapp1 folder:
$ cd /home/justinschier/www
$ ls -l
drwxrwxrwx 13 root www-data 4096 2010-03-20 08:02 testapp1

My log folder:
$ cd /home/justinschier/www/testapp1
$ ls -l
...
drwxrwxrwx 2 root www-data 4096 2010-03-20 08:02 log
... (everything's the same permissions and ownership as log)

My log files:
-rwxrwxrwx 1 root www-data 1676 2010-03-22 20:58 development.log
-rwxrwxrwx 1 root www-data 0 2010-03-20 08:02 production.log
-rwxrwxrwx 1 root www-data 0 2010-03-20 08:02 server.log
-rwxrwxrwx 1 root www-data 0 2010-03-20 08:02 test.log

I know the development.log is showing now, BUT that's because I tried
running WebBrick. That's why there's something in there.

My /public folder (no .htaccess file):
$ cd /home/justinschier/www/testapp1/public
$ ls -al
drwxrwxrwx 5 root www-data 4096 2010-03-22 08:21 .
drwxrwxrwx 13 root www-data 4096 2010-03-20 08:02 ..
-rwxrwxrwx 1 root www-data 947 2010-03-20 08:02 404.html
-rwxrwxrwx 1 root www-data 930 2010-03-20 08:02 422.html
-rwxrwxrwx 1 root www-data 948 2010-03-20 08:02 500.html
-rwxrwxrwx 1 root www-data 0 2010-03-20 08:02 favicon.ico
drwxrwxrwx 2 root www-data 4096 2010-03-20 08:02 images
-rwxrwxrwx 1 root www-data 7466 2010-03-20 08:02 index.html
drwxrwxrwx 2 root www-data 4096 2010-03-20 08:02 javascripts
-rwxrwxrwx 1 root www-data 204 2010-03-20 08:02 robots.txt
drwxrwxrwx 3 root www-data 4096 2010-03-22 15:30 stylesheets

Still when I run this, the log files don't grow at all:
http://testapp1.fuse.sonikserver.com/
Welcome Aboard Page loads correctly

http://testapp1.fuse.sonikserver.com/rails/info/properties
and I still get "We're sorry, but something went wrong"

Apache has instances running as both root and www-data:
$ ps aux | grep apache2
root 14157 0.0 0.3 141016 8040 ? Ss 12:24 0:00 /usr/
sbin/apache2 -k start
root 14170 0.0 0.0 23192 1888 ? Sl 12:24 0:00 /var/
lib/gems/1.8/gems/passenger-2.2.11/ext/apache2/
ApplicationPoolServerExecutable 0 /var/lib/gems/1.8/gems/
passenger-2.2.11/bin/passenger-spawn-server /usr/bin/ruby1.8 /tmp/
passenger.14157
www-data 14175 0.0 0.2 141492 6036 ? S 12:24 0:00 /usr/
sbin/apache2 -k start
www-data 14176 0.0 0.2 141348 5812 ? S 12:24 0:00 /usr/
sbin/apache2 -k start
www-data 14177 0.0 0.2 141348 5812 ? S 12:24 0:00 /usr/
sbin/apache2 -k start
www-data 14178 0.0 0.2 141476 5796 ? S 12:24 0:00 /usr/
sbin/apache2 -k start
www-data 14179 0.0 0.2 141476 5924 ? S 12:24 0:00 /usr/
sbin/apache2 -k start
www-data 14183 0.0 0.2 141476 5852 ? S 12:24 0:00 /usr/
sbin/apache2 -k start
www-data 14188 0.0 0.2 141016 4692 ? S 12:25 0:00 /usr/
sbin/apache2 -k start
root 14206 0.0 0.0 7340 884 pts/0 S+ 12:27 0:00 grep
apache2

I even got rid of the symbolic link (above) and no change:

$ vi /etc/apache2/sites-available/default

Now reads:

... default part ommitted for this post ....

LoadModule passenger_module /var/lib/gems/1.8/gems/passenger-2.2.11/
ext/apache2/mod_passenger.so
PassengerRoot /var/lib/gems/1.8/gems/passenger-2.2.11
PassengerRuby /usr/bin/ruby1.8

<VirtualHost *:80>
    ServerName testapp1.fuse.sonikserver.com
    DocumentRoot /home/justinschier/www/testapp1/public
    <Directory /home/justinschier/www/testapp1/public>
        Allow from all
        Options -MultiViews
    </Directory>
</VirtualHost>

Man, I am so out of ideas. Anything else you can think of for me to
try?

Thanks again SOOO much. If you have an Amazon wish list, I'm totally
buying you something.

Success!! (Sorry for the delay - I've been under the weather and busy
with some other things)

It's working in development, but not production mode. (Can you help
with that?)

The changes I made:
1. Change ownership on everything to www-data:www-data
2. chmod -R 775 /home
3. Added RailsEnv development to apache config
4. touch /home/justinschier/testapp1/tmp/restart.txt
5. Deleted /log/production.log

After that, I got the configuration screen to show correctly and the
development.log was written

However, when I changed to RailsEnv production and restarted apache,
now I get "We're sorry, but something went wrong". I'm sure the /
config/environments/production.rb file is original. The /log/
production.log file was re-created automatically

The production.log now only has this one line:
# Logfile created on Tue Apr 06 15:11:14 -0700 2010

Questions:
A. Should justinschier be the user, instead of www-data?
B. Is there anything else I should check to see why production isn't
working?

Thanks very, very much,
Justin Schier