Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Debug Levels Rails - The level ":debug" show all logs. I want ONLY ERRORS. Is it possible?

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.

like image 995
Diego Somar Avatar asked Oct 22 '25 14:10

Diego Somar


1 Answers

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

like image 90
MZaragoza Avatar answered Oct 25 '25 20:10

MZaragoza



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!