Added check on printing logs.