Reputation: 4267
I implemented Trace.TraceInformation. Where does this log the information to? Is there a window in VS 2010 that shows this or is there a file that it writes to?
catch (DbEntityValidationException dbEx)
{
foreach (var validationErrors in dbEx.EntityValidationErrors)
{
foreach (var validationError in validationErrors.ValidationErrors)
Trace.TraceInformation("Property: {0} Error: {1}",
validationError.PropertyName, validationError.ErrorMessage);
}
}
Upvotes: 0
Views: 2540
Reputation: 6741
This information will be passed to elements of Trace.Listeners collection, which by default contains DefaultTraceListener
To enable tracing, add the /d:TRACE flag to the compiler command line when you compile your code, or add #define TRACE to the top of your file.
To specify trace output file you may add TextWriterTraceListener
to Listeners in your config:
<configuration>
<system.diagnostics>
<trace autoflush="false" indentsize="4">
<listeners>
<remove name="Default" />
<add name="myListener" type="System.Diagnostics.TextWriterTraceListener" initializeData="c:\myListener.log" />
</listeners>
</trace>
</system.diagnostics>
</configuration>
Upvotes: 2