Yes, the System.Diagnostics.TraceListener class. You will need to define the TRACE constant for it to work, but you can use a number of built in tracelisteners, through configuration of your app.config:
The app.config looks something like this if you want to write to a file, there are a lot of filters you can also add:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.diagnostics>
<trace autoflush="false" indentsize="4">
<listeners>
<add name="yourName" type="System.Diagnostics.TextWriterTraceListener" initializeData="c:\mylogfile.txt" />
</listeners>
</trace>
</system.diagnostics>
</configuration>
And usage:
Trace.TraceError("There's been an error captain: {0}", e);
Trace.TraceWarning("The system broke but don't worry.");
Trace.TraceInformation("Starting up the engines.");
Personally I wouldn't write to a text file if you can avoid it, the Event Log is a better location as you can sort, filter, the logs are auto-purged and you don't get file lock up issues.