title: How to log exception stack trace using stackdriver in .net-core?
body: <p>I have setup stackdriver logging on a .net core 2.0 project and it seems to work fine. There is one issue while logging exceptions - stack trace or any exception related info is not getting logged.</p>
  
  <p>The below piece of code throws a null exception and <code>.LogError</code> method is used to log the exception - it takes an exception object as a parameter.</p>
  
  <pre><code>// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
  public void Configure(IApplicationBuilder app, IHostingEnvironment env,
                        ILoggerFactory loggerFactory) {
      StackdriverLogger = loggerFactory.CreateLogger("ImageCompressInfo");
      try {
          throw new NullReferenceException("null");
      } catch (Exception ex) {
          StackdriverLogger.LogError(ex, "Exception in configure 2", null);
      }
  
      if (env.IsDevelopment()) {
          app.UseDeveloperExceptionPage();
      }
      app.UseGoogleExceptionLogging();
      app.UseMvc();
  }
  </code></pre>
  
  <p>The following log is generated. As you can see there is no exception related info - not even the <code>string argument</code> passed while throwing the exception. </p>
  
  <p><a href="https://i.stack.imgur.com/LJKwm.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/LJKwm.png" alt="Stackdriver log"></a></p>
  
  <p>Am I using the library correctly? Is there a way to capture the entire stack trace using .net-core logging and stackdriver?</p>
  
  <p><strong>Edit</strong> - Unhandled Errors are caught and reported to Error Reporting. The same errors are also present in Logs with complete stack trace. <strong>It seems when using <code>.LogError()</code> function, errors do not forward to Error Reporting.</strong> </p>