How to make log4net work with a chainsaw on a local machine

I would like to use log4net UdpAppender with Apache Chainsaw to log messages from my ASP.NET web application. I followed the instructions on the log4net website, but Udp packets were not sent (the firewall was disabled and I tried to control my machine using TcpView - no udp packets were created at all, other applications were added again). Debugging Log4net does not give any errors, UdpAppender is added to the registrars. I don’t know what is missing.

My configuration file:

<log4net debug="true"> <renderer renderingClass="Logging.HttpContextRenderer" renderedClass="System.Web.HttpContext" /> <appender name="UdpAppender" type="log4net.Appender.UdpAppender"> <localPort value="8080" /> <remoteAddress value="127.0.0.1" /> <remotePort value="8080" /> <layout type="log4net.Layout.XmlLayoutSchemaLog4j"> <locationInfo value="true" /> </layout> </appender> <root> <priority value="ALL"/> <appender-ref ref="UdpAppender"/> </root> </log4net> 
+4
source share
2 answers

Here's an archive of someone with similar problems using log4net udp appender: http://www.mail-archive.com/ log4net-user@logging.apache.org /msg03906.html

You can use Chainsaw V2 with a plain text file if it is easier (using VFSLogFilePatternReceiver).

Soon, a new version of Chainsaw will be released with many improvements. A preview version and screenshot are available here:

http://people.apache.org/~sdeboy/

+1
source

I also had the same problem and I found that uninstalling

 <localPort value="8080" /> 

I decided.

I tested the application with an example on the log4net UdpAppender page: http://logging.apache.org/log4net/release/sdk/log4net.Appender.UdpAppender.html

but I had to change the line

 IPEndPoint remoteEndPoint = new IPEndPoint(IPAddress.Any, 0); 

to

 IPEndPoint remoteEndPoint = new IPEndPoint(IPAddress.Any, 8080); 

If you use this, you can simply rewrite the received messages into a sliding log file using log4net, and I believe Chainsaw can read this.

This might work: http://devintelligence.com/log4netviewer/

If this does not work, you can debug log4net or use the internal log mechanism mentioned in this article: Log4Net runs on a Dev machine, fails when deploying to a shared host (using the same db / connstring) to fix any further problems.

+1
source

All Articles