Logger::Format not defined (NameError) [NOOB]


#1

I have just installed apache2 / php4 / mysql and RoR on a clean and
minimal Ubuntu (5.10) server.

I have set up a test site and can reach the “Welcome on board” index
page.

However when I run “ruby script/generate contoller firsttest” I get the
following error.

./script/…/config/…/vendor/activesupport/lib/active_support/clean_logger.rb:13:in
`remove_const’: constant Logger::Format not defined (NameError)
from
./script/…/config/…/vendor/activesupport/lib/active_support/clean_logger.rb:13
from
./script/…/config/…/vendor/activesupport/lib/active_support.rb:31
from ./script/…/config/environment.rb:50
from script/generate:4

I believe that this can be patched using this patch at
http://dev.rubyonrails.org/ticket/2245

Two questions. Is this the right course of action and (as a complete
newbie) how do you apply a patch?

Thanks for any assistance.

Neil


#2

OK… Sorry to waste everyones time… I have solved this myself by
engaging my brain. For anyone else with the same problem here is the
fix.

Edit the file ./vendor/activesupport/lib/active_support/clean_logger.rb
(the clue is in the error message!!) and comment out the line 13 so that
it reads:

require ‘logger’

class Logger #:nodoc:

Silences the logger for the duration of the block.

def silence(temporary_level = Logger::ERROR)
old_logger_level, self.level = level, temporary_level
yield
ensure
self.level = old_logger_level
end

private

remove_const “Format”

Format = "%s\n"
def format_message(severity, timestamp, msg, progname)
  Format % [msg]
end

end

The error message was produced because the constant Format did not exist
and therefore cannot be removed!!

Neil