enhance log output; fix a fatal bug in last revision that it won't output any data.