TCC-2584 refactored write method, added configurable logging on connection