Geeks With Blogs

News
View Szymon Kobalczyk's profile on LinkedIn

Szymon Kobalczyk's Blog A Developer's Notebook

I just found via Michael Flanakin's Web Log that you can use the Chainsaw tool, a GUI based log viewer from Log4J project, with the Log4Net enabled applications. Here what you need to do:

1. First download the application from the above link. It requires Java. I know it sucks. But don't be put off just yet.

2. Then in the config file of your .NET application add following appender:

<log4net>
<appender name="UdpAppender" type="log4net.Appender.UdpAppender">
     <param name="RemoteAddress" value="127.0.0.1" />
     <param name="RemotePort" value="8080" />
     <layout type="log4net.Layout.XmlLayoutSchemaLog4j, log4net" />
  </appender>
  <root>
     <priority value="ALL" />
     <appender-ref ref="UdpAppender" />
     ...
  </root>
</log4net>

Note the special type of layout used to format XML messages.

3. Finally create a config file with following content:

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
<log4j:configuration
 xmlns:log4j="http://jakarta.apache.org/log4j/"
 debug="false">
    <plugin name="UDPReceiver"
class="org.apache.log4j.net.UDPReceiver">
       <param name="Port" value="8080" />
    </plugin>
</log4j:configuration>

When you start Chainsaw and it asks you for configuration (Warning: no receivers defined) select the third option (Let me search for configuration file) and browse for the config file you just created.

4. Start your application and you should see your loggers added in logger tree panel on the chainsaw-log tab. You can filter to see messages only from your logger by right-clicking on it and selecting “Focus on '...' “ option from the menu.

If you can't stand running Java application on your computer the you can try the Log4Net Viewer written by Naumtsev Taras. It has far less capabilities but is sufficient for most tasks.

Posted on Friday, July 15, 2005 6:55 AM Development | Back to top


Comments on this post: Using Chainsaw Log Viewer with Log4Net

# re: Using Chainsaw Log Viewer with Log4Net
Requesting Gravatar...
Witam,

if you use UDP appender, you might lose log messages.
Left by boris on Jul 28, 2005 2:26 PM

# re: Using Chainsaw Log Viewer with Log4Net
Requesting Gravatar...
That is why I always also add some file appender. But this configuration with Chainsaw is great for online debuging or profilling cause I can filter on loggers and instantly see what is happening.
Left by Szymon on Jul 28, 2005 3:51 PM

# re: Using Chainsaw Log Viewer with Log4Net
Requesting Gravatar...
Thanks, been wondering how to get this horrible thing running.
Left by Aaron on Feb 15, 2006 10:14 AM

# re: Using Chainsaw Log Viewer with Log4Net
Requesting Gravatar...
For Aaron:
To run this thing, you first need to install Java Runtime on your computer and perhaps also Java Web Service. Just search for it on www.sun.com.
Then, clicking the Launch button on http://logging.apache.org/log4j/docs/chainsaw.html will download/compile/start the application. You can save a link to the app from your browser and store it e.g. on your Desktop.
Left by Pavol on May 18, 2006 9:21 AM

# re: Using Chainsaw Log Viewer with Log4Net
Requesting Gravatar...
Should have been "Java Virtual Machine" instead of "Java Runtime", sorry
Left by Pavol on May 18, 2006 9:23 AM

# re: Using Chainsaw Log Viewer with Log4Net
Requesting Gravatar...
I’m currently working on a Chainsaw alternative, developped in C# 2.0, called Log2Console, with a simple but nice GUI. It’s still a beta version but it’s functional. Currently the available receivers are: Remoting, File and UDP.

The logger hierarchy is displayed in a tree view, and it’s possible to deactivate each of them. You can also filter according to the log level and the UI is customizable.

The project is hosted on CodePlex (a great service!!), the current release and the sources are available here: http://www.codeplex.com/log2console

You may want to give a try, your feedback is welcome!
Left by Statyk7 on Jul 16, 2007 2:02 AM

# re: Using Chainsaw Log Viewer with Log4Net
Requesting Gravatar...
@Statyk7:

Your log2console is a nice tool! I'm locking forward to the final version..

I figured out that log4j:throwable tags are currently not handled. Could you implement this handling in the next beta release? :-)

Cheers, braD
Left by Brad on Aug 02, 2007 12:46 PM

# re: Using Chainsaw Log Viewer with Log4Net
Requesting Gravatar...
"It requires Java. I know it sucks."

hee-he-he oh you .Net fanboy.

For some of us, the grass is green on both sides ;)
Left by Henrik on Jul 09, 2008 2:41 PM

# re: Using Chainsaw Log Viewer with Log4Net
Requesting Gravatar...
A final version of Log2Console has been release a few months ago, it is quite stable and comes with some new features.

Check it out: http://log2console.codeplex.com/
Left by Statyk7 on Jul 16, 2009 3:56 AM

# re: Using Chainsaw Log Viewer with Log4Net
Requesting Gravatar...
While overall a good first attempt, a number of usability issues, combined with the SocketAppender bug which essentially locks up the Sockets, thus causing both Chainsaw and the monitored Application (for examplke JBOSS) to stall causing many hours of frantic searching and debugging prevent this from being used in any capacity other than as a novelty.
Left by k on Jan 18, 2010 12:03 PM

# re: Using Chainsaw Log Viewer with Log4Net
Requesting Gravatar...
How to open a existing Log4Net log fine in Log2Console application.
Left by Praveen on Jan 19, 2010 7:19 AM

# re: Using Chainsaw Log Viewer with Log4Net
Requesting Gravatar...
Does anybody successfully launched the Log4net with Chainsaw over UDP on Windows 7 ??????
Left by Josef S. on Feb 03, 2010 11:09 AM

# re: Using Chainsaw Log Viewer with Log4Net
Requesting Gravatar...
"It requires Java. I know it sucks." - Without Java, ".Net" - Boy, you wouldn't even have log4net. In fact, you wouldn't even have C#.
Left by Chris on Apr 28, 2010 1:48 AM

# Discount
Requesting Gravatar...
Hey you all just check out the discount link, hops this will be benificial for you.
Left by Alex on May 04, 2010 2:43 PM

# re: Using Chainsaw Log Viewer with Log4Net
Requesting Gravatar...
If you're looking for a free open source LogViewer for Log4Net you can look at this one on CodePlex :
http://yourlog4netviewer.codeplex.com/
Left by olivier on Jul 01, 2010 8:43 AM

# re: Using Chainsaw Log Viewer with Log4Net
Requesting Gravatar...
I have to admit that I am so glad that I have found this your post because I have been searching for some information about the Chainsaw Log Viewer almost two hours. You helped me a lot indeed and reading this your article I have found many new and useful information about this subject. Well, I will definitely bookmark your website and wait for other useful and informative posts like this one in the future. Regards, Lenny.
Left by baltimore payday loans Belair-Ed on Nov 26, 2010 8:30 PM

Your comment:
 (will show your gravatar)


Copyright © Szymon Kobalczyk | Powered by: GeeksWithBlogs.net | Join free