Create Log File

Hey @CamiCat, I can think of a simple solution if you just want to deal with logs in a text file. Just use ‘Append Line’ activity within the catch block of the workflows. You may need to make sure that the path/name of the txt file that you use is same wherever you may wanna capture the logs. Also, just make sure that exception is handled for all the activity.

Few things you may wanna implement:
→ Add today’s date as the name of the file, so that you will have a new log file for each day. (Note: ‘Append Line’ activity will create a new file, you just dont have to create file before running the process)
LogFileName = "Logs\Logs-" + Today.ToString("ddMMyyyy") + ".txt"
→ For each exception you may wanna capture the date and time when it was thrown as well. You can use something like this under ‘Text’ attribute for your Append Line activity:
DateTime.Now.ToString + ": Application Failed to Launch." + e.Message

Let me know if it helps.

Thanks,
Rammohan B.

6 Likes