title: How to prevent truncation of service exception in event log
body: <p>We have a c# windows service that is failing which causes an error log message to be written to the windows event log. The error message contains the exception information but it is truncated, preventing us from seeing the critical information. </p>
  
  <p>How do we increase the data that is written to the log message so we can see the full stacktrace of the exception? </p>
  
  <p>This is what we currently see in the event viewer.</p>
  
  <pre><code>&lt;EventData&gt;
      &lt;Data&gt;Service cannot be started. System.ArgumentException: Keyword not supported: 'port'. 
   at System.Data.Common.DbConnectionOptions.ParseInternal(Hashtable parsetable, String connectionString, Boolean buildChain, Hashtable synonyms, Boolean firstKey) 
   at System.Data.Common.DbConnectionOptions..ctor(String connectionString, Hashtable synonyms, Boolean useOdbcRules) 
   at System.Data.SqlClient.SqlConnectionString..ctor(String connectionString) 
   at System.Data.SqlClient.SqlConnectionFactory.CreateConnectionOptions(String connectionString, DbConnectionOptions previous) 
   at System.Data.ProviderBase.DbConnectionFactory.GetConnectionPoolGroup(DbConnectionPoolKey key, DbConnectionPoolGroupOptions poolOptions, DbConnectionOptions&amp; userConnectionOptions) at System.Data.SqlClient.SqlConnection.ConnectionString_Set(DbConnectionPoolKey key) at System.Data.SqlClient.SqlConnection.set_ConnectionString(String value) 
   at System.Data.Entity.Infrastructure.Interception.DbConnectionDispatcher.&lt;SetConnectionString&gt;b__1a(DbConnection t...&lt;/Data&gt; 
      &lt;/EventData&gt;
  &lt;/Event&gt;
  </code></pre>
  
  <p>Note the end of the stacktrace is truncated with "...".</p>