Re: C# log component

Tech-Archive recommends: Speed Up your PC by fixing your registry



Thanks Morten,


I have found one,TextWriterTraceListener.

http://msdn2.microsoft.com/en-us/library/system.diagnostics.textwritertracelistener.aspx

After reading through this page, I am still a little confused about how to
use it step by step. Do you have a tutorial?


regards,
George

"Morten Wennevik [C# MVP]" wrote:

On Sat, 15 Sep 2007 17:28:02 +0200, George <George@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote:

Thanks Morten,


You mean Microsoft .Net itself does not provide log function? I only need to
log to a local file.


regards,
George

"Morten Wennevik [C# MVP]" wrote:

On Sat, 15 Sep 2007 11:12:00 +0200, George <George@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote:

Hello everyone,


I am using C# and Visual Studio 2005 to develop a class library. I am
wondering whether there are any built-in log component in C# so that I can
utilize directly other than write from scratch?

I am also wondering if there does exist such log component, if multiple
processes using the built-in log component to open the same log file to write
log (in my application, I want all processes which loads the class library
DLL to have a common log file), will there be any risk of racing condition
(e.g. interlacing log of one process and another process)? Do we need any
lock/synchronization approach?


thanks in advance,
George


Hi George,

In addition to Marc's suggestion there is also log4net

http://logging.apache.org/log4net/index.html

I haven't tried logging to file, but it seems robust enough that numerous logging sources should not be a problem.

--
Happy coding!
Morten Wennevik [C# MVP]



Not really. The closes thing is the Trace and Debug classes. But you need to write some code to make them good logging classes.

--
Happy coding!
Morten Wennevik [C# MVP]

.



Relevant Pages

  • Re: C# log component
    ... I am also wondering if there does exist such log component, ... I haven't tried logging to file, but it seems robust enough that numerous logging sources should not be a problem. ... Morten Wennevik [C# MVP] ... The closes thing is the Trace and Debug classes. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Logging components?
    ... I think Logging is pretty much individual, so that usualy everyone has their ... {Write Logged exception into the Log file? ... {Write exception with a short string description into the Global App Log ... > By logging components, I specifically DON'T MEAN components for catching ...
    (borland.public.delphi.thirdpartytools.general)
  • Re: Phantom /var full messages
    ... if you could isolate it to just snort or just MySQL. ... without restarting the program that's logging to them. ... compresses the current log file into a new file, ...
    (freebsd-questions)
  • Re: Annoying 1202 errors
    ... Enabling this logging tracks all changes and settings applied to the machine ... Name: UserEnvDebugLevel ... I recommend that you remove any existing log file and then use gpupdate ... feature GUEST. ...
    (microsoft.public.win2000.group_policy)
  • Re: Theodore Adorno, a prophet of data systems design
    ... >> Can you translate the above into English please? ... > at compile time or runtime, up to you) what level of logging you wish. ... >> a single log file from multiple threads for anyone with even a beginner's ... > Actually, I can't guarantee that it will work in a multithreaded program, ...
    (comp.programming)