title: How to use Python to log to a new directory each day?
body: <p>I'm setting up a readout system that takes data from a number of instruments and needs to log the data to a log file. This system will be running for weeks at a time, and so each day should have a log file. Since these instruments are being manipulated over this time, they may also have log files associated with their status.</p>
  
  <p>With this, I have a directory in which all of the logs are stored, for example 'C:/logs'. Since there will be multiple log files associated with each day, I'd like to automate the creation of a new subdirectory in the the logs folder each day, so the structure of the files are something like <code>'C:/logs/20190814' for August 14, 'C:/logs/20190815' for the 15th</code>, and so on. Then, in each daily directory I would have a number of log files such as <code>'data.log', 'instrument1.log', 'instrument2.log'</code>, etc.</p>
  
  <p>Ideally, these would roll over at midnight each day.</p>
  
  <p>I have been using the Python Logging module to attempt to create these log files. I have been able to implement the <code>TimedRotatingFileHandler</code>, but the problem with this is </p>
  
  <p>(1) I want to change the directory that the log files are in based on the day, but leave their titles the same (e.g. <code>'C:/logs/20190814/data.log', 'C:/logs/20190815/data.log'</code>)</p>
  
  <p>(2) the <code>TimedRotatingFileHandler</code> saves the files not with a <code>'%Y%m%d.log'</code> extension, but rather <code>'.log.%Y%m%d'</code>, which is inconvenient to work with. I'd like to create a new directory each day and start writing a new log in the new day's directory.</p>