title: Save logs - SimpleHTTPServer
body: <p>How can I save the output from the console like</p>
  
  <p>"192.168.1.1 - - [18/Aug/2014 12:05:59] code 404, message File not found"</p>
  
  <p>to a file?</p>
  
  <p>Here is the code:</p>
  
  <pre><code>import SimpleHTTPServer
  import SocketServer
  
  PORT = 1548
  
  Handler = SimpleHTTPServer.SimpleHTTPRequestHandler
  
  httpd = SocketServer.TCPServer(("", PORT), Handler)
  
  print "serving at port", PORT
  
  httpd.serve_forever()
  </code></pre>