File truncate and write to support Log write with flags. Not tested.