I have some singleton class that I want to make sure is only getting
instantiated once. I have something like this:
class Someclass
include Singleton
def initialize
@something = nil
end
def something
return @something unless @something.blank?
logger.warn “Performing expensive query”
@something = ‘Some expense query’
end
end
In development it will always output the log message because the classes
are reloaded every time. I want to confirm that this is not the case in
production. I have a mongrel cluster so I should expect at max amount of
log messages to be the size of my cluster. Is there anyway to output the
mongrels instance id in the log message so I know for sure that there is
only 1 output message per mongrel.
Something like logger.warn “#{MONGREL.id} is performing expensive query”
Is there a way I can do this?