[logging] New pthread locking for concurrent access