Hello all,
i wanna use logger to log all errors and exceptions that occurs in run
time, so i create new file “logfile.log” and put it in /log path in
rails application and put these lines of code in environment.rb file
file = File.open("#{RAILS_ROOT}/log/logfile.log", File::WRONLY |
File::CREAT)
logger = Logger.new(file)
logger.level = Logger::ERROR
and inside actions with each part of code that is surrounded with begin
and rescue i put this line
logger.error “#{e.message}”
ex:
begin
blah blah
rescue Exception => e
logger.error “#{e.message}”
end
but logfile.log always empty.
so please anyone help me in this point
thanks in advanced