Python(tested in 2.7) logging module can be used for logging in a file or printing on the screen while running the script or scheduling it via cron.
1.Write in a file.
import logging
logging.basicConfig(filename='/your/log/file', level=logging.DEBUG, format='%(asctime)s - %(levelname)s - %(message)s')
response='<some execution output>'
logging.debug(response)
logging.debug("This is a sample log")
2.Print on screen
import logging
logging.basicConfig(level=logging.DEBUG, format='%(asctime)s - %(levelname)s - %(message)s')
response='<some execution output>'
logging.debug(response)
logging.debug("This is a sample log")
For more information visit: