Added logging. Support of nested locking for write.