Using LogView4Net with EPiServer

image I must recommend logview4net as a tool when you debug EPiServer and other apps using log4net.

Logview4net can listen for UDP packages from your development environment and is in my opinion a little bit faster to work with than logging to file. (Read handling the enormous, ever growing EPiServerErrorLog.txt files that can not be deleted…)

Read more about how to setup logging in EPiServer 5. Remove the comment around the udpLogAppender at the end of EPiServerLog.config and start logview4net and listen on the specified port.

UdpAppender Unable to send logging event to remote host

When you try to setup log4view to use the UdpAppender it will not work and you will get error like this in your Debug Output:

ERROR [UdpAppender] Unable to send logging event to remote host fe80::9af:9baa:8874:74d3%8 on port 8888.

System.Net.Sockets.SocketException: An address incompatible with the requested protocol was used
   at System.Net.Sockets.Socket.SendTo(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags, EndPoint remoteEP)
   at System.Net.Sockets.UdpClient.Send(Byte[] dgram, Int32 bytes, IPEndPoint endPoint)
   at log4net.Appender.UdpAppender.Append(LoggingEvent loggingEvent)

It appears that there is are issues in net 2.0 with IPv6 interfering with the parsing of the remoteAddress but the bug fix appear not to work.

Workaround to IPV6 Issue

I guess you can recompile the library yourself with correct compiler directives but it is easier to use another address than 127.0.0.1 as loop-back address to workaround the defect.

I use 127.0.0.2 like suggested here and then everything works fine.

<appender name="udpLogAppender" type="log4net.Appender.UdpAppender" >
  <encoding value="utf-16" />
  <remoteAddress value="127.0.0.2" />
  <remotePort value="8888" />
  <layout type="log4net.Layout.PatternLayout">
    <conversionPattern value="%date %level [%thread] %type.%method - %message%n%exception" />
  </layout>
</appender>