Could be a crash inside the log function?
Anyway, did you run it with a debugger? Assuming visual studio, hit F5. It will build your program in debug mode and attach a debugger. When the program crashes you can pinpoint the exact location and look at the state of the variables to see what is going on.