Prepare for logging