title: AttributeError: 'FastAPI' object has no attribute 'logger'
body: <p>I am Migrating my code from Python flask to Fast-API. I am facing an issue in adding loggers to fast API, It will display </p>
  
  <blockquote>
    <p>"AttributeError: 'FastAPI' object has no attribute 'logger'"</p>
  </blockquote>
  
  <p>Please refer the code for more info</p>
  
  <pre><code>from fastapi import FastAPI, HTTPException
  import uvicorn
  from logging.handlers import RotatingFileHandler
  import logging
  
  app = FastAPI()
  
  if __name__ == '__main__':
  
      formatter = logging.Formatter(
          "[%(asctime)s.%(msecs)03d] %(levelname)s [%(thread)d] - %(message)s", "%Y-%m-%d %H:%M:%S")
      handler = RotatingFileHandler('/log/abc.log', backupCount=0)
      logging.getLogger().setLevel(logging.NOTSET)
      app.logger.addHandler(handler)
      handler.setFormatter(formatter)
  
      app.logger.info('****************** Starting Server *****************') # "AttributeError: 'FastAPI' object has no attribute 'logger'"
      uvicorn.run()
  </code></pre>