Where does Rails show the logging output

10,355

Logs by default go to the #{Rails.root}/log/#{Rails.env}.log file. Most likely that's development.log in your case.

Share:
10,355

Related videos on Youtube

Admin
Author by

Admin

Updated on June 04, 2022

Comments

  • Admin
    Admin about 2 years

    In some method I am wrting something like this:

    Rails.logger.debug("------I WAS HERE ------- ")
    

    I can see that if I put a break point on the next line of that code, it is hitting that break point, using RubyMine IDE and running the server it from its Debug mode, so it has passed that logger.debug method but where did it print it? I can't find it in Console ... Is there an easier way?

  • Admin
    Admin about 11 years
    now I have problem finding that path :) how about "puts" ? maybe I just write a puts , then hopefully that one shows in console
  • Dave S.
    Dave S. about 11 years
    puts will show up in the console, yes. Your log directory is at the top level of your project - e.g. so wherever you're looking in redmine, just go upwards from the current code until you get to the top of the project (e.g. where the app, lib, and other dirs are).
  • jangosteve
    jangosteve about 4 years
    If your app isn't logging to the default path and you don't want to guess and check where the logger output is going, and you are in a console or other environment where you have access to the logger object (which you do if you can run Rails.logger.debug), then you can also get the path with this: Rails.logger.instance_variable_get("@logdev").dev. That will return the object that's receiving the logger output. If it's a file, you can additionally call path on that to get the full path.