add the logic to turn on or off log on the fly.