output log before quitting (fix #208)