I want to be able to print a stack trace in c# to a txt file as stated below. Note The Following :
- I know the Ex.Message wont get the stack trace. I want to use the FileHandler just to write the StackTrace Message into the Text File.
The FileHandler Class internal code is not important. I want to know how to obtain the stacktrace on the Exception being catched here.
try { //some code } // I just inherit from exception class (the message member, nothing big here) catch (CustomException ex) { //I want to write the stacktrace here instead of the ex.Message FileHandler.Write("DeveloperErrors.txt", "Stack Trace" + ex.Message, System.IO.FileMode.Append); }