moved logging definition to main only.