title: Adding python logging to FastApi endpoints, hosted on docker doesn't display API Endpoints logs
body: <p>I have a fastapi app on which I want to add python logging. I followed the basic tutorial and added this, however this doesn't add API but just gunicorn logging.</p>
  <p>So I have a local server hosted using docker build so running server using <code>docker-compose up</code> and testing my endpoints using api client (Insomnia, similar to postman).
  Below is the code where no log file is created and hence no log statements added.</p>
  <p>My project str is as follows:</p>
  <pre><code>project/
    src/ 
      api/
        models/ 
          users.py
        routers/
          users.py
        main.py
        logging.conf
  </code></pre>
  <pre><code>&quot;&quot;&quot;
  main.py Main is the starting point for the app.
  &quot;&quot;&quot;
  import logging
  import logging.config
  from fastapi import FastAPI
  from msgpack_asgi import MessagePackMiddleware
  import uvicorn
  
  from api.routers import users
  
  
  logger = logging.getLogger(__name__)
  
  
  app = FastAPI(debug=True)
  app.include_router(users.router)
  
  
  @app.get(&quot;/check&quot;)
  async def check():
      &quot;&quot;&quot;Simple health check endpoint.&quot;&quot;&quot;
      logger.info(&quot;logging from the root logger&quot;)
      return {&quot;success&quot;: True}
  
  
  </code></pre>
  <p>Also, I am using <code>gunicorn.conf</code> that looks like this:</p>
  <pre><code>[program:gunicorn]
  command=poetry run gunicorn -c /etc/gunicorn/gunicorn.conf.py foodgame_api.main:app
  directory=/var/www/
  autostart=true
  autorestart=true
  redirect_stderr=true
  </code></pre>
  <p>And <code>gunicorn.conf.py</code> as</p>
  <pre><code>import multiprocessing
  bind = &quot;unix:/tmp/gunicorn.sock&quot;
  workers = multiprocessing.cpu_count() * 2 + 1
  worker_class = &quot;uvicorn.workers.UvicornWorker&quot;
  loglevel = &quot;debug&quot;
  errorlog = &quot;-&quot;
  capture_output = True
  chdir = &quot;/var/www&quot;
  reload = True
  reload_engine = &quot;auto&quot;
  accesslog = &quot;-&quot;
  access_log_format = '%(h)s %(l)s %(u)s %(t)s &quot;%(r)s&quot; %(s)s %(b)s &quot;%(f)s&quot; &quot;%(a)s&quot;'
  </code></pre>
  <p>This is my output terminal for the above API endpoint on docker:</p>
  <p><a href="https://i.stack.imgur.com/M2DRS.png" rel="noreferrer"><img src="https://i.stack.imgur.com/M2DRS.png" alt="enter image description here" /></a></p>
  <p>Could anyone please guide me here? I am new to FastApi so some help will be appreciated.</p>