Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

web.config system.diagnostics log to a file

Status
Not open for further replies.

cappmgr

Programmer
Jan 29, 2003
639
US
Does anyone see the problem with this
Code:
<trace autoflush="false" indentsize="4">
	<listeners>
		<remove type="System.Diagnostics.DefaultTraceListener" /> 
		<add name="TextLogListener" type="System.Diagnostics.TextWriterTraceListener"
		initializeData="C:\TraceLog.txt" />
	</listeners>
</trace>
here is the error
Parser Error Message: Exception in configuration section handler.
Line 17: <system.diagnostics>
If I remove initializeData="C:\TraceLog.txt" it runs fine but since I have not stated a file nothing is written.

I have no problems writing to the event log this works fine
Code:
<trace autoflush="false" indentsize="4">
	<listeners>
		<remove type="System.Diagnostics.DefaultTraceListener" /> 
		<add name="EventLogListener" type="System.Diagnostics.EventLogTraceListener"
		initializeData="myRegKey" />
	</listeners>
</trace>
Any help greatly appreciated.
Marty
 
try using \\ instead \

--------------------------
"two wrongs don't make a right, but three lefts do" - the unknown sage
 
DazzleD, No thank you anyways.
It was a permission problem.
Marty
 
Has anyone used the web.config to add a listener? I have given ASPNET/Machinename full access to write to the file. I have steped through and see
System.Diagnostics.Trace.WriteLine(sMsg)
being executed but the file remains empty.
Thank you,
Marty
 
I forgot Trace.Flush
Thank you.
Marty
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top