What is the best way to log Exceptions to a string

.net, c#

Solution

Simply method ToString is the best:

ex.ToString();

Problem

Anyone have a good way to output an Exception in C# to a string that handles inner exceptions and the such? I am sure every developer has her own implimentation of this, but I can't find my old one and want to see what better ones are out there. Here is one without recursion for inner exceptions as an example: ``` var Message = String.Format("Exception Message: \n{0}\n\nStackTrace: \n{1}", ex.Message, ex.StackTrace); ```

Original source