bug fix for DatabaseLog.

thread loop should have an interruption point,
and shouldn't check the queue all the time.