title: Simple Rotating Python Logger (RotatingFileHandler)
body: <p>I'm trying to write a simple logger but I'm getting an exception thrown. I'd like some advice on why this exception's getting thrown, but will also appreciate some design suggestions (keeping in mind that i'd like to keep this simple).</p>
  
  <p>Code:</p>
  
  <pre><code>import logging
  import logging.handlers
  
  class Logger:
  
      @staticmethod
      def log_to_file(logText):
  
          logFile = logging.handlers.RotatingFileHandler('/var/log/sosms/sosmsd.log', 'a', 1000, 5)
          formatter = logging.Formatter()
          logFile.setFormatter(formatter)
  
          logFile.emit(logText)
  
          return
  </code></pre>
  
  <p>Output:</p>
  
  <pre><code>kyle@boxmunch:/var/log/sosms$ /etc/rc.local
  Traceback (most recent call last):
    File "/usr/lib/python2.7/logging/handlers.py", line 77, in emit
       if self.shouldRollover(record):
     File "/usr/lib/python2.7/logging/handlers.py", line 156, in shouldRollover
      msg = "%s\n" % self.format(record)
    File "/usr/lib/python2.7/logging/__init__.py", line 719, in format
      return fmt.format(record)
    File "/usr/lib/python2.7/logging/__init__.py", line 464, in format
      record.message = record.getMessage()
  AttributeError: 'str' object has no attribute 'getMessage'
  Traceback (most recent call last):
    File "/git/sosms/sosmsd/Main.py", line 10, in &lt;module&gt;
      Logger.Logger.log_to_file('SOSMSD starting..')
    File "/git/sosms/sosmsd/Logger.py", line 14, in log_to_file
      logFile.emit(logText)
    File "/usr/lib/python2.7/logging/handlers.py", line 83, in emit
      self.handleError(record)
    File "/usr/lib/python2.7/logging/__init__.py", line 799, in handleError
      record.filename, record.lineno))
  AttributeError: 'str' object has no attribute 'filename'
  </code></pre>