jojoba2010 wrote:
- Where I save this log info. I mean shall i save them in XML or word File ?
you can save the data anyways you want it. xml is structured and easier to browse through. text is easy to implement.
jojoba2010 wrote:
- How can I have Log for error in try catch with this informations 1.Error Name : 2.Form Name: 3.Function Name that error occurred : 4.Date_Time when error occurred :
void AddLogEntry(String errorName, String formName, String functionName)
{
DateTime entryTime = DateTime.Now;
//depending on how you want to save the entry i.e. xml or plain text
//append the text in the log file with the entry
//search in google on how to add text to a text/xml file.
}
or, you can do this:
void AddLogEntry(Exception ex)
{
String errorName = ex.message;
String trace = ex.StackTrace; //stack trace will give you a brief history on why the error occured
DateTime entryTime = DateTime.Now;
//depending on how you want to save the entry i.e. xml or plain text
//append the text in the log file with the entry
//search in google on how to add text to a text/xml file.
}
hope this helps and good luck :)