Fixed log file bugs.

Warning: only log to file. It run so fast and can generate GB in
second. Always prepare to ctrl - c.