4

I have an app in AWS Ec2 and I want to see the errors ( 500, 502, 50x, 403, 404 etc. ) ina log file.

The file config / environments / production.rb

Have the code:

config.log_level = :debug

I tried to change this to :warn, :info, :error, :fatal. Really this values shows ONLY ERRORS, but the information is very limited.

The value :debug shows many datails, but... Shows all logs too...

I am seeing the erros log here:

EC2 ROOT: cd /var/log/nginx
CMD: tail -f error.log

There are another log folder, inside the app, here:

{appfolder}/current/log/production.log

But this file is empty. The logs are not being saved here.

Some informations:

ruby -v: 2.2.2p95
rails -v: 4.2.1
OS: Ubuntu 14.04.2 LTS

Tks everyone.

Diego Somar
  • 941
  • 1
  • 11
  • 28

2 Answers2

6

Here is the the official documentation,

in your #config/environments/production.rb you can add/change the log_level like this

  # Use the lowest log level to ensure availability of diagnostic information
  # when problems arise.
  # :debug, :info, :warn, :error, and :fatal
  config.log_level = :error

I hope that this helps

Happy Hacking

MZaragoza
  • 10,108
  • 9
  • 71
  • 116
0

Check Logger class http://ruby-doc.org/stdlib-2.1.0/libdoc/logger/rdoc/Logger.html. Just use log level suitable for you.

Sebastian
  • 2,618
  • 3
  • 25
  • 32