Solved

writing exceptions to a log file

Posted on 2004-10-19
1
160 Views
Last Modified: 2010-04-01
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.
0
Comment
Question by:healingtao
1 Comment
 
LVL 12

Accepted Solution

by:
OnegaZhang earned 500 total points
ID: 12355199
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When writing generic code, using template meta-programming techniques, it is sometimes useful to know if a type is convertible to another type. A good example of when this might be is if you are writing diagnostic instrumentation for code to generat…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now