tags:

views:

1575

answers:

4

I'm looking for a good TraceListener for .Net that supports rolling over the log file based on size limits.

Constraints

  • Uses .Net built in Trace logging
  • Independent class or binary that's not part of some gigantic library
  • Allows rolling over a log file based on size
+1  A: 

I'm a big fan of log4net (http://logging.apache.org/log4net/index.html), it's very easy to configure and supports just about any log type you want, but can have custom ones written as well.

It can also do different actions depending on the log level. We log all messages to a text file and Error -> Fatal send emails

Slace
problem is I prefer to use the integrated .Net trace logging
Then check out the TraceAppender in it, that'll log to the trace of the app
Slace
+1  A: 

I am using NLog and I am very satisfied. Source code is well written and it is easy to extend and modify. Documentation is good and it is very easy to configure.

Some Links:

Robert Vuković
+1  A: 

I have used both Log4Net and Nlog. I prefer NLog but really once they are setup you forget they are there anyway (untill something breaks, then your glad it is there!). there should be plenty of documentation on both out in the interweb

RhysC
+5  A: 

You could use Microsoft.VisualBasic.Logging.FileLogTraceListener, which comes built-in with the .NET Framework. Don't let the VisualBasic in the namespace scare you, you'll just have to reference the microsoft.visualbasic.dll assembly and it should work fine with C#.

csgero
Found this thread via Google... thanks csgero for pointing out the built in option... looking at the docs for FileLogTraceListener, it sounds perfect, and no need to deploy a 3rd party assembly. Being a C# programmer I never even knew about the Microsoft.VisualBasic namespace.