title: Python logging: use milliseconds in time format
body: <p>By default <code>logging.Formatter('%(asctime)s')</code> prints with the following format:</p>
  
  <pre><code>2011-06-09 10:54:40,638
  </code></pre>
  
  <p>where 638 is the millisecond. I need to change the comma to a dot:</p>
  
  <pre><code>2011-06-09 10:54:40.638
  </code></pre>
  
  <p>To format the time I can use:</p>
  
  <pre><code>logging.Formatter(fmt='%(asctime)s',datestr=date_format_str)
  </code></pre>
  
  <p>however the <a href="http://docs.python.org/library/time.html#time.strftime" rel="noreferrer">documentation</a> doesn't specify how to format milliseconds. I've found <a href="https://stackoverflow.com/questions/698223/how-can-i-parse-a-time-string-containing-milliseconds-in-it-with-python">this SO question</a> which talks about microseconds, but a) I would prefer milliseconds and b) the following doesn't work on Python 2.6 (which I'm working on) due to the <code>%f</code>:</p>
  
  <pre><code>logging.Formatter(fmt='%(asctime)s',datefmt='%Y-%m-%d,%H:%M:%S.%f')
  </code></pre>