Made logging thread safe