Fixed a bug

1. Moved common util functions for logging into acktools.
2. When log is being refreshed to run logrotate, existing handlers were
not cleared properly.