Whats the better way of Trace/Log into a text file.

R

RK

Our Application solution consists Web Service and 3 other C# class
libraries.
We added Trace Listener to the application and writing log information
in all our components.

Since multiple sessions access the same application, log messages are
interspersed and looks clumsy. And more its hard keep maintaining the
log, as components calls among themselves multiple times.

what is the better way of maintaining session level log writing to
tracelistener all at once. I am thinking of having Session level
StringBuilder Object and appending all the log and writing all at once
to tracelistener. Is anybody can suggest me what are the tradeoffs
involved in it?

thanks in advance.
--RK
 
K

Klaus H. Probst

There is none =) The problem is not so much identifying which message is
coming from where (you could use a GUID associated to a process ID or app
domain) but the fact that you're dealing with a flat text file. Unless you
use some other media (like a database) you'll have to come up with a way to
sort or organize the text output. XML might come in handy here - you could
use a simple stylesheet to filter and sort entries, for example.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top