Improve logging code. Continuously write log in CLI app.