Enhancement

1. logger
2. refactor
3. Fix daemon thread problem.