Fix thread safety logging issue