title: What is the best practice for capturing all inner exception details?
body: <p>What is the best practice for logging complete exception details including all possible inner exceptions?</p>
  
  <p>Currently, I use the following code:</p>
  
  <pre><code>try
  {
      //some code that throws an exception
  }
  catch(Exception ex)
  {
      do
      {
          Console.WriteLine(ex.Message+ex.StackTrace);
          ex=ex.InnerException;
      }while(ex!=null)
  }
  </code></pre>
  
  <p>Are there any scenarios where this code may fail?</p>