Replace print with logging
Separate application and server access logs.
Log all uncaught exceptions