I have searched StackOverflow and haven't found an answer to my problem.
I run a Python script on Task Scheduler that runs a few times per day and it sends out an email to various people. It ran well for the past year but over the past week it sometimes started getting stuck half way through and so it did send out the email to everyone. I'm trying to figure out what is causing the error and what it is getting stuck on, but I can't find any way to save or output the Python console log with error messages while running in Task Scheduler. How do I see what is causing the error? 
Thanks for your help.
please select the task from the task scheduler library and click history. from there select "Action completed" task category and right click.. then select event properties.. you will find the resulting code.. if this shows 0 that is okay if there is something else you need to look for that code!
this applies for Windows 2012 R2 servers
Logging Python console errors in Task Scheduler