writing exceptions to a log file
Posted on 2004-10-19
I would like to catch any exception in my code and write it to a log file. My program will be running as a cron job every night and if an error or exception happens I need to be able to tell exactly where and since it's an automatic process I figure it would make sense to write errors or exceptions to a log file. Can someone write sample code on how to catch exceptions and write it to a file? I'm using visual c++ 6.0 and my project is win32 console project. It would be preferable to show a line of code (where it happened) and name of file, and time it happened.