Forum: Ruby on Rails Logger::Format not defined (NameError) [NOOB]

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Neil Bain (Guest)
on 2006-03-30 14:11
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

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

`remove_const': constant Logger::Format not defined (NameError)
        from ./script/../config/environment.rb:50
        from script/generate:4

I believe that this can be patched using this patch at

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 B. (Guest)
on 2006-03-30 14:52
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

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
    self.level = old_logger_level

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

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

This topic is locked and can not be replied to.