COMappender is an appender for log4net to send the output to a COM port.  This is especially useful when developing using Windows CE, as there might not be a UI screen available, but COM ports often are.  Along with the source files (C# using .net 2.0), the project contains an NUnit project for testing.  This code has been used on Windows CE 6 and Windows XP and 7.


Using the appender

in the log4net configuration, I put the following:

<appender name="SerialAppender" type="PowerSoft.log4net.Appender.COMAppender, COMAppender, Version=, Culture=neutral, PublicKeyToken=null">
   <PortNumber value="10" />
   <BaudRate value="115200" />
   <layout type="log4net.Layout.PatternLayout">
      <conversionPattern value="%date [%thread] %-5level %logger: %message%newline"/>


There is no restriction on port numbers (other than it has to be a positive value).  Parity, Number of data bits and Number of Stop bits are currently hard-coded at N-8-1. There is no error checking done on the BaudRate field.  The code is not idiot proof.

The rest should be self-explanatory.

Last edited Mar 22, 2013 at 3:30 PM by erictcodeplex, version 6