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.
Related videos on Youtube
![Admin](/assets/logo_square_200-5d0d61d6853298bd2a4fe063103715b4daf2819fc21225efa21dfb93e61952ea.png)
Author by
Admin
Updated on June 04, 2022Comments
-
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 about 11 yearsnow I have problem finding that path :) how about "puts" ? maybe I just write a puts , then hopefully that one shows in console
-
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 theapp
,lib
, and other dirs are). -
jangosteve about 4 yearsIf 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 callpath
on that to get the full path.