enhance log related code.