title: NameError: name 'open' is not defined When trying to log to files
body: <p>So I chose to implement logging in my discord.py bot which is fine and dandy and works alright. but once I add logging to files, be it through using a filehandler</p>
  <pre><code>handler = logging.FileHandler(
      filename=&quot;../logs/bot.log&quot;,
      mode=&quot;a&quot;)
  formatter = logging.Formatter(&quot;%(asctime)s %(name)-30s %(levelname)-8s %(message)s&quot;)
  handler.setFormatter(formatter)
  handler.setLevel(logging.DEBUG)
  logging.getLogger().addHandler(handler)
  </code></pre>
  <p>Or through the basicConfig</p>
  <pre><code>logging.basicConfig(filename=&quot;../logs/bot.log&quot;, filemode=&quot;a&quot;, format=&quot;%(asctime)s %(name)-30s %(levelname)-8s %(message)s&quot;, level=logging.DEBUG)
  </code></pre>
  <p>I always get this Traceback on exit</p>
  <pre><code>Exception ignored in: &lt;function ClientSession.__del__ at 0x7fe1330b9790&gt;
  Traceback (most recent call last):
    File &quot;/home/lukas/PycharmProjects/coconutbot/venv/lib/python3.8/site-packages/aiohttp/client.py&quot;, line 314, in __del__
    File &quot;/usr/lib/python3.8/asyncio/base_events.py&quot;, line 1740, in call_exception_handler
    File &quot;/usr/lib/python3.8/logging/__init__.py&quot;, line 1463, in error
    File &quot;/usr/lib/python3.8/logging/__init__.py&quot;, line 1577, in _log
    File &quot;/usr/lib/python3.8/logging/__init__.py&quot;, line 1587, in handle
    File &quot;/usr/lib/python3.8/logging/__init__.py&quot;, line 1649, in callHandlers
    File &quot;/usr/lib/python3.8/logging/__init__.py&quot;, line 950, in handle
    File &quot;/usr/lib/python3.8/logging/__init__.py&quot;, line 1182, in emit
    File &quot;/usr/lib/python3.8/logging/__init__.py&quot;, line 1172, in _open
  NameError: name 'open' is not defined
  Exception ignored in: &lt;function ClientResponse.__del__ at 0x7fe13300b430&gt;
  Traceback (most recent call last):
    File &quot;/home/lukas/PycharmProjects/coconutbot/venv/lib/python3.8/site-packages/aiohttp/client_reqrep.py&quot;, line 757, in __del__
    File &quot;/home/lukas/PycharmProjects/coconutbot/venv/lib/python3.8/site-packages/aiohttp/connector.py&quot;, line 177, in release
    File &quot;/home/lukas/PycharmProjects/coconutbot/venv/lib/python3.8/site-packages/aiohttp/connector.py&quot;, line 629, in _release
    File &quot;/home/lukas/PycharmProjects/coconutbot/venv/lib/python3.8/site-packages/aiohttp/client_proto.py&quot;, line 62, in close
    File &quot;/usr/lib/python3.8/asyncio/selector_events.py&quot;, line 690, in close
    File &quot;/usr/lib/python3.8/asyncio/base_events.py&quot;, line 719, in call_soon
    File &quot;/usr/lib/python3.8/asyncio/base_events.py&quot;, line 508, in _check_closed
  RuntimeError: Event loop is closed
  </code></pre>
  <p>I'm utterly stumped as to what  did wrong as the Traceback doesnt include any of my own files. I'm suspecting I might have to do some manual cleanup but even if I do <code>logging.shutdown()</code> I get the same Traceback</p>