Solved

writing exceptions to a log file

Posted on 2004-10-19
1
159 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Errors will happen. It is a fact of life for the programmer. How and when errors are detected have a great impact on quality and cost of a product. It is better to detect errors at compile time, when possible and practical. Errors that make their wa…
What is C++ STL?: STL stands for Standard Template Library and is a part of standard C++ libraries. It contains many useful data structures (containers) and algorithms, which can spare you a lot of the time. Today we will look at the STL Vector. …
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
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.

757 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

21 Experts available now in Live!

Get 1:1 Help Now