Replace use of Throwable.printStackTrace(...) with logging.