blob: 39e5983924fb282d599f663985b15ce1c2af8197 [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<HTML>
<HEAD>
<link rel="stylesheet" href="stylesheet.css" type="text/css">
</HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#FF0000" VLINK="#800000" ALINK="#FF00FF" BACKGROUND="?">
<h2>ZeroConf (Zero Configuration)</h2>
<p>One of the hardest parts of any network-based application is configuring which bits connect to what, and how
do they connect to each other. Each device that can be connected <emphasis>to</emphasis> already knows
the configuration details required to connect to it, but every other device that may wish to connect to it
will need to be provided with this information so the connection can be established.
</p>
<p>
ZeroConf aims to eliminate the time-consuming aspect of connecting devices together. The device broadcasts the
configuration details reqired to connect or work with the service over a multicast protocol. You probably already have
devices on your local network such as printers that are automatically discovered by your computer.
</p>
<p>
Zeroconf is an open-standard that many vendors are using to reduce cost of configuration. The <b>JmDNS</b> project
is an Apache 2.0 licensed library that implements the ZeroConf protocol. Chainsaw and log4j use
JmDNS to broadcast Appender information so that a matching Receiver can be easily created to connect to each other
to stream logging messages into Chainsaw.
</p>
<p>
<ul>
<li><a href="http://www.zeroconf.org" target="_new">http://www.zeroconf.org</a></li>
<li><a href="http://jmdns.sf.net" target="_new">http://jmdns.sf.net</a></li>
</ul>
</p>
<h2>Interesting... So what do I need to use ZeroConf with Chainsaw & log4j?</h2>
<p>
Most of the network-based appenders are ZeroConf-capable - all you have to do to use ZeroConf is to
download the JmDNS package (at least version 1.0), add the JmDNS jar to your application's classpath, and set the "advertiseViaMulticastDNS"
parameter to 'true' for any of the appenders or receivers you want to advertise (most of the time you will want to advertise appenders, so they can be
automatically detected by Chainsaw).</p>
<p>You're log4j.xml configuration file could be as simple as this:</p>
<pre>
&lt;log4j:configuration debug="false" threshold="debug" xmlns:log4j="http://jakarta.apache.org/log4j/&gt;
&lt;appender name="zeroconf" class="org.apache.log4j.net.SocketHubAppender"&gt;
&lt;param name="Name" value="MyZeroConfSockeHubAppender" /&gt;
&lt;param name="advertiseViaMulticastDNS" value="true" /&gt;
&lt;/appender&gt;
&lt;!--ROOT Logger--&gt;
&lt;root&gt;
&lt;level value="INFO" /&gt;
&lt;appender-ref ref="zeroconf" /&gt;
&lt;/root&gt;
&lt;/log4j:configuration&gt;
</pre>
<p>
Once you have started your application using this configuration, from within Chainsaw, the ZeroConf tab will show detected
applications. You can simply double click on the detected appender and Chainsaw will connect a Receiver to it. You can even tick the "Auto-Connect"
check box, and next time Chainsaw see's this application, it will automatically connect to it.
</p>
<p>Most of the network-based Receivers are also ZeroConf capable, giving ZeroConf-aware appenders or applications
the ability to discover the receivers and configure appenders to connect to those Receivers.
</p>
<h2>Cool... But I have some applications that use log4j 1.2.x. Will it still work?</h2>
<p>Yes. We have designed a backward compatible mechanism to expose prior versions of log4j's SocketHubAppender (ZeroConfSocketHubAppender)
so that Chainsaw can detect it automatically.
</p>
<h2>But... Surely there's a catch?</h2>
<p>A small catch. Because it's based on a multicast protocol, routers tend to block these packets, and so it's likely that your production computers,
which are usually in a heavily protected network won't be able to broadcast their configuration information. If you have a VPN
into this sort of network it is possible that these multicast packets can traverse the network.</p>
<h2>Oh... So is this even useful?</h2>
<p>It's extremely useful for development, QA and staging environments. Usually the QA/Staging environment is isolated from your development
team, but having them monitor logs from these machines would be handy. Or your QA team may want to copy/paste some ERROR messages from
QA/staging to notify the dev team. ZeroConf gives your whole software development team an easy way to get access to your logging events.</p>
</BODY>
</HTML>