Replace e.printStacktrace() with proper logging.