log4net on the Compact Framework

I was reminded of log4net today when working on a project. The client asked a logging framework and the cool part is that it’s a Compact Framework application. Sure enough log4net supports the Compact Framework.

There are a couple of minor differences that you should be aware of if you are interested in using log4net on the Compact Framework. First of all, not all of the appenders make sense – like the RemotingAppender, the EventLogAppender and the OracleAppender. Secondly, there is no mechanism for retrieving assembly level attributes so you have to explicitly initialize and shut down the log4net engine.

 

static void Main()

{

      try

      {

            //This line configures the log4net engine.

log4net.Config.DOMConfigurator.Configure(

new FileInfo(@”\log4net.config”));

 

            frmLogin loginForm = new frmLogin ();

            loginForm.ShowDialog();

                  Application.Run(new frmMain());

            }

      }

      catch (System.Exception e)

      {

            _log.Error(“Main“, e);

      }

      finally

      {

            //This line shuts down the log4net engine

            log4net.LogManager.Shutdown();

      }

}

 

The other thing that was interesting is that the online help on http://logging.apache.org/log4net showed conversion patterns with %message%newline to print the message and then put a newline in the file. I had to use %m%n because the first one there printed as

 

My stringessage

ewline

 

which was not quite what was expected.

 

Have fun with log4net, it’s a great lightweight logging framework for the compact framework.

The Origional Dancing DE firesback: Drew Robbins in encore

Since Andrew Duthie fired off his rendition of “Love Shack”, Drew Robbins had to come back with his Karaoke rendition of this MC Hammer Song.


MC Hammer he’s not but I gotta say that he’s learned a step or two since TechEd (The origional Dancing DE). Maybe I should start trying those dancing machines…


I’m not sure who that is singing in the background but they are not bad – not up to Duthie standards (remember that he’s damn good) – but trust me there were worse performances at the Karaoke bar at the MVP party at the Science Fiction Museum.


The Dancing DEs


Picture of the Dancing DEs: Andrew Duthie on the Left and Drew Robbins on the right.


So far the count is:

1 to Andrew Duthie for the singing
0.5 to Drew for attempting to Dance
1 to Drew for dancing the second time

Gotta Vote for who’s the best – use the comments to vote for your favorite!

So it’s Drew up by half a point. Any other contestants out there? Gotta great Dancing DE moment on video that you’d love to share with the world? Let me know and I’ll make sure that it’s posted!