title: How to change TimedRotatingFileHandler to mode 'w' in logging.conf file
body: <p>I have a <code>logging.conf</code> file, with the following content: </p>
  
  <pre><code>[loggers]
  keys=root
  
  [logger_root]
  level=INFO
  handlers=file
  
  [formatters]
  keys=simple
  
  [formatter_simple]
  format=[%(levelname)s] %(asctime)s : %(name)s - %(message)s
  datefmt=%H:%M:%s
  
  [handlers]
  keys=file
  
  [handler_file]
  class=handlers.TimedRotatingFileHandler
  interval=midnight
  backupCount=5
  formatter=simple
  level=INFO
  args=(log_directory,)
  </code></pre>
  
  <p>I want to delete the older logs everytime I run the code, therefore I would like to set <code>mode</code> to <code>w</code> however I am not sure how to do it. </p>
  
  <pre><code>[handler_file]
  ...
  kwargs={'mode': 'w'}
  </code></pre>
  
  <p>doesn't seem to work (the logger is still appending logs instead of overwriting the existing log file). </p>