title: .Net Core 1.1 not serializing object while logging
body: <p>I have ASP.NET Core 1.1 application and i am using Serilog for logging. I want to log DTO object by preserving its structure. </p>
  
  <p>So If i directly use <code>Serilog.Log</code> to log the DTO, like below</p>
  
  <pre><code>Serilog.Log.Information("Processing {@DTO}", dto);
  </code></pre>
  
  <p>Then Serilog serializes the DTO and log it as expected. </p>
  
  <p>However i am injecting <code>Microsoft.Extension.Logging.ILogger</code> into controller. I thought it will use configured logger for logging and that will serialize the object while logging, but its not. It only logs type name of the object.</p>
  
  <pre><code>        public class HomeController
          {
              private readonly Microsoft.Extensions.Logging.ILogger _logger = null
  
              public HomeController(Microsoft.Extensions.Logging.ILogger logger)
              {
                 _logger = logger;
              }           
  
              public asyc IActionResult Index()
              {               
                  var dto = GetDTO();
  
                  //did not work
                  _logger.LogInformation("DTO {dto}",dto);
  
                  //did not work
                  _logger.LogInformation("DTO {@dto}",dto);
  
                  //worked when i use serilog directly
                  Serilog.Log.Information("DTO {@dto}",dto);
  
                  //did not work
                  Serilog.Log.Information("DTO {dto}",dto);
              }
  
          }
  </code></pre>
  
  <p><strong>Startup.cs</strong> </p>
  
  <pre><code>    public Startup(IHostingEnvironment env)
      {
          var builder = new ConfigurationBuilder()
              .SetBasePath(env.ContentRootPath)
              .AddJsonFile("appsettings.json", optional: false, reloadOnChange: true)
              .AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true)
              .AddEnvironmentVariables();
          Configuration = builder.Build();
  
          if (env.IsDevelopment())
          {
              // This will push telemetry data through Application Insights pipeline faster, allowing you to view results immediately.
              builder.AddApplicationInsightsSettings(developerMode: true);
          }
  
          Configuration = builder.Build();
  
          Log.Logger = new LoggerConfiguration()
          .ReadFrom.Configuration(Configuration)
          .CreateLogger();
  
  }
  </code></pre>
  
  <p><strong>appsettings.json</strong></p>
  
  <pre><code>"Logging": {
      "IncludeScopes": false,
      "LogLevel": {
        "Default": "Information"
      }
    },
    "Serilog": {
      "WriteTo": [
        {
          "Name": "ColoredConsole"        
        }
      ]
    },
  </code></pre>