1

I simple question:

# development.rb
config.log_level = :debug


class ApplicationController < ActionController::Base
  before_action :my_log

  private

  def my_log 
    Rails.logger.debug <<-LOG
      [CUSTOM DEBUG] 
        some info 123
        #{request.method.inspect}
        ...

    LOG
  end

And still after that development.log is empty.

UPDATE:

It does log the requests, but to the terminal, not to development.log

1 Answers1

0

Did you make sure the user running the Rails server has write permissions to the log file?

I've seen this happen if the server is started as root the first time

sudo rails s

which created the development.log file owned by root. Then if a non-privileged user starts the server

rails s

the log file cannot be written to because it's owned by root.

messanjah
  • 8,977
  • 4
  • 27
  • 40