Error: Called id for nil, which would mistakenly be 4

I define a class:

class BuildLogger
  @@build_logger=nil

  def self.get_build_logger(file_name=nil)
    if @@build_logger == nil ###this line will thrown an error
      @@build_logger=Logger.new("build_logger")
      @@build_logger.level = DEBUG
    end
    return @@build_logger
  end
end

I invoke BuildLogger.get_build_logger in a controller. An error "Called
id for nil, which would mistakenly be 4 -- if you really wanted the id
of nil, use object_id" is always thrown on the "if" line. I have no idea
about this error. does anyone know this problem?