[13] add lock to write log ; any cosmetic change;