[Mono-list] log4net port to Mono !

jopryor jopryor@vt.edu
Mon, 3 Mar 2003 12:43:31 -0500

I haven't looked extensively at the log4j documentation yet (you might want to 
link to it from the log4net site so *some* documentation is available), but I 
still have some questions and comments.

First, the question: why use log4j over the existing .NET logging framework -- 
the System.Diagnostics.TraceListener class (with hooks into the Trace, Debug, 
and Switch classes).  The biggest difference appears to be that log4j permits 
"hierarchical" logging.  I'm not sure I immediately see the use of it, but I'm 
sure it can be useful.

Most everything else appears (at a glance, I didn't look long) to be in .NET 
already.  This includes XML configuration files, and the ability to log to 
various sources (Files, Streams -- and, by implication, sockets -- and the NET 
event log under .NET).  So why use log4j?

This isn't a flame, I'm just curious.

Second, my comments.  As suggested above, it would be a good idea to provide a 
link to the log4j documentation (or provide specific log4net documentation) so 
users don't have to go to apache and search for log4j.  Especially when the 
www.apache.org search engine provides incorrect results. :-)

You also might want to investigate adding .NET features to the code.  In 
particular, look up the Conditional attribute.  This would prevent you from 
having code like (taken from the FAQ):

        log.Debug("Entry number: " + i + " is " + entry[i]);

You could instead make "log.Debug" conditional on the symbol DEBUG:

    void Debug (string msg) {/* ... */}

which would remove the "if" statement:

    log.Debug ("Entry number: " + i + " is " + entry[i]);

The call to "log.Debug" would only be present when the symbol "DEBUG" is 
defined by the compiler.

 - Jon

>===== Original Message From Gert Driesen <gert.driesen@pandora.be> =====
>We've finally managed to port log4net completely to Mono, we only had to add 
conditional compilation directives to a few classes and exclude one class 
(EventLogAppender, which logs events to the Windows event log).
>If you don't know, log4net is a logging framework that was initialliy 
inspired by log4j. We have kept the framework as similar to the original log4j 
as possible while taking advantage of new features in the .NET runtime.
>We have support for the following appenders (compare them with loggers) :
>- ADONetAppender (log events to a database)
>- ASPNetAppender (log events to ASP.NET tracing facility)
>- ConsoleAppender (log events to the console)
>- FileAppender (log events to a file)
>- NetSendAppender (log events using a NET SEND message, only supported on 
Windows NT or higher)
>- RemotingAppender (log events to a remote sink)
>- RollingFileAppender (log events to a file, with support for rolling over on 
date or size)
>- SMTPAppender (log events using SMTP)
>- UdpAppender (log events using UDP datagrams)
>- ....
>We have log4net running internally on the following runtimes :
>- MS .NET Framework 1.0
>- MS .NET Framework 1.1
>- MS .NET Compact Framework 1.0
>- MS Shared Soure CLI (Rotor) 1.0
>- Mono 0.21
>We're currenly working on releasing a new beta which will contain the 
binaries and sources for all the runtime versions.  The current beta only 
supports .NET 1.0, so we've been really busy since the last beta :-)  You can 
download the current beta at http://www.sourceforge.net/projects/log4net.
>However, we're still looking for people to run our Mono port through some 
tests on Linux. Is there anyone interested in testing log4net on Linux, pelase 
let me know and I'll send you the binaries and a sample application.
>Of course, you can always get the sources from our CVS and build it yourself 
(using nant).