How to store and retrieve exception.ToString () values ​​in a csv file in .NET framework?

I recently updated 1 registration component to register Exception.ToString and not Exception.Message.ToString (), the problem with my exceptions is now this:

  • Exception.ToString () contains line breaks and
  • May contain a tab character, which I divide into
  • There may be other potential run-time obstacles that I might not have thought of, so logging and searching become the subject of data.

I need a reliable way to store and extract these errors in a text file in order to keep the original .toString error as much as possible. Along the side, I save 3 other fields - previously when using exception.message.toString I used | as a delimiter character, but now, since the error is more than 1 line, the code does not work.

Any help would be appreciated, Thanks

+3
source share
1 answer

How about replacing the character with Exception.ToString () and replacing the newlines in your separator "|" . The last three fields will still be the last and will still use the same separator.

"|" "||"? split , , "||", . , split "|" , .

+2

Source: https://habr.com/ru/post/1735346/


All Articles