c# - TextWriterTraceListener on background thread -
i've got 3rd party component uses traceswitch functionality allow me output traces of what's going on inside. unfortunately, running switches in verbose mode, textwritertracelistener consumer (outputs file) slows down application much.
it isn't critical traced data written immediately, there way data written on lower priority thread? perhaps task?
edit
upon further investigation, seems merely turning on switches without attaching listener causes slowdown. i'm going hold of component provider.
would still interesting hear answer though.
write own extension tracelistener. in extension, put trace strings onto list<string> , when count gets high enough, write list out file , clear list start again. flush list on dispose().
this can extended use thread pool queue new task actual write.
this doesn't guarantee improve performance. if sure io slowing things down.
Comments
Post a Comment