title: Log all exception information for any kind of exception
body: <p>I'm developing with C#, ASP.NET MVC Web Api, Entity Framework and .NET Framework 4.0.</p>
  
  <p>I have this code to log an exception:</p>
  
  <pre><code>public void LogCompleteException(
      string controllerName,
      string actionName,
      Exception exception)
  {
      string exceptionMessage = string.Empty;
  
      Exception e = exception;
      if (e.InnerException == null)
          e = null;
      else
          while (e.InnerException != null) e = e.InnerException;
  
      if (e == null)
          exceptionMessage = exception.Message;
      else
          exceptionMessage = string.Format("{0}\n\rInnerException: {1}", exception.Message, e.Message);
  
      _logger.ErrorFormat(
          LogTextFormatString,
          ExceptionText,
          controllerName,
          actionName,
          exceptionMessage);
  }
  </code></pre>
  
  <p>But on my log file I have found this:</p>
  
  <blockquote>
    <p>Validation failed for one or more entities. See
    'EntityValidationErrors' property for more details.</p>
  </blockquote>
  
  <p>When I wrote 'See 'EntityValidationErrors' property for more details.',  <strong>I'm only showing an example</strong> where I haven't log an important property. </p>
  
  <p>There are a lot of kind of exceptions; but with my method I'm not logging all the relevant information because there could be properties like 'EntityValidationErrors' that I don't log.</p>
  
  <p>When I pass the exception to log it I don't know what properties it has, and I don't know how to log each property it has.</p>
  
  <p>Do you know a method to log an exception completely? My code doesn't long exceptions with an <code>EntityValidationErrors</code> property or any other important property.</p>
  
  <p>I'm doing the logging with log4net.</p>