title: Use application class instance variable inside get block
body: <p>I am using sinatra and I have the code:</p>
  
  <pre><code>class App &lt; Sinatra::Base
    configure do
      @logger = Logger.new "./log"
    end
  
    @logger.info "App started"          #this line works
  
    get "/info" do
      @logger.info "/info inquired"     #this does not work and complain @logger is nilClass
    end
  end
  </code></pre>
  
  <p>Why <code>@logger</code> inside get block gives a nil object? How can I use <code>@logger</code> in this case?</p>
  
  <hr>
  
  <p>PS. If I use a class variable like <code>@@logger</code>, the code above works. But why the instance variable is not working in this case?</p>