Logging statement wasn't logging at only the right time.