c# - TextWriterTraceListener does not work -
config file:
<system.diagnostics> <trace> <listeners> <add name="console" type="system.diagnostics.consoletracelistener" initializedata="false"></add> <add name="text" type="system.diagnostics.textwritertracelistener" initializedata="d:\uat\logs\bifit.log" traceoutputoptions="datetime"></add> </listeners> </trace> </system.diagnostics> the code:
static void main(string[] args) { try { trace.writeline("running bifit test server."); } } i can see text in cosole window. , file created, empty. remember there autoflush property somewhere?
you recall correctly - defined on trace element:
<trace autoflush="true"> ... </trace> autoflush - optional attribute. specifies whether trace listeners automatically flush output buffer after every write operation.
Comments
Post a Comment