blob: acfb315ae595f2638fb6f229f46a44528df0c7ef [file] [log] [blame]
<!DOCTYPE html>
<!--
| Generated by Apache Maven Doxia Site Renderer 1.9.2 from src/site/apt/zeroconf.apt at 2022-05-30
| Rendered using Apache Maven Fluido Skin 1.8
-->
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="generator" content="Apache Maven Doxia Site Renderer 1.9.2" />
<title>Apache Chainsaw &#x2013; </title>
<link rel="stylesheet" href="./css/apache-maven-fluido-1.8.min.css" />
<link rel="stylesheet" href="./css/site.css" />
<link rel="stylesheet" href="./css/print.css" media="print" />
<script src="./js/apache-maven-fluido-1.8.min.js"></script>
</head>
<body class="topBarDisabled">
<div class="container-fluid">
<header>
<div id="banner">
<div class="pull-left"><a href="http://logging.apache.org/" id="bannerLeft"><img src="images/ls-logo.jpg" alt="Logging Services"/></a></div>
<div class="pull-right"><a href="../log4j/2.x/" id="bannerRight"><img src="images/logo.png" alt="Apache log4j"/></a></div>
<div class="clear"><hr/></div>
</div>
<div id="breadcrumbs">
<ul class="breadcrumb">
<li id="publishDate">Last Published: 2022-05-30<span class="divider">|</span>
</li>
<li id="projectVersion">Version: 2.2.0-SNAPSHOT<span class="divider">|</span></li>
<li class=""><a href="http://www.apache.org/" class="externalLink" title="Apache">Apache</a><span class="divider">/</span></li>
<li class=""><a href="http://logging.apache.org/" class="externalLink" title="Logging Services">Logging Services</a><span class="divider">/</span></li>
<li class=""><a href="http://logging.apache.org:80/chainsaw/" class="externalLink" title="Chainsaw">Chainsaw</a><span class="divider">/</span></li>
<li class="active "></li>
</ul>
</div>
</header>
<div class="row-fluid">
<header id="leftColumn" class="span2">
<nav class="well sidebar-nav">
<ul class="nav nav-list">
<li class="nav-header">Get Chainsaw</li>
<li><a href="download.html" title="Download"><span class="none"></span>Download</a></li>
<li><a href="changes-report.html" title="Changes"><span class="none"></span>Changes</a></li>
<li><a href="https://www.apache.org/licenses/LICENSE-2.0" class="externalLink" title="License"><span class="none"></span>License</a></li>
<li><a href="distributionnotes.html" title="Important Distribution Notes"><span class="none"></span>Important Distribution Notes</a></li>
<li class="nav-header">About Chainsaw</li>
<li><a href="index.html" title="Introduction"><span class="none"></span>Introduction</a></li>
<li><a href="quicktour.html" title="Quick Tour"><span class="none"></span>Quick Tour</a></li>
<li class="active"><a href="#"><span class="none"></span>Zeroconf</a></li>
<li><a href="roadmap.html" title="Roadmap"><span class="none"></span>Roadmap</a></li>
<li><a href="apidocs/index.html" title="JavaDoc"><span class="none"></span>JavaDoc</a></li>
<li class="nav-header">Manual</li>
<li><a href="viewing-log-events.html" title="Viewing Log Events"><span class="none"></span>Viewing Log Events</a></li>
<li><a href="colorizing-output.html" title="Colorizing Output"><span class="none"></span>Colorizing Output</a></li>
<li><a href="expression-rules.html" title="Expression Rules"><span class="none"></span>Expression Rules</a></li>
<li><a href="configuration-library.html" title="Configuration Library"><span class="none"></span>Configuration Library</a></li>
<li class="nav-header">Community</li>
<li><a href="mail-lists.html" title="Mailing Lists"><span class="none"></span>Mailing Lists</a></li>
<li><a href="issue-tracking.html" title="Issue Tracking"><span class="none"></span>Issue Tracking</a></li>
<li class="nav-header">Development</li>
<li><a href="source-repository.html" title="Repository"><span class="none"></span>Repository</a></li>
<li><a href="xref/index.html" title="Cross Reference"><span class="none"></span>Cross Reference</a></li>
<li><a href="dependencies.html" title="Dependencies"><span class="none"></span>Dependencies</a></li>
<li><a href="cpd.html" title="Duplication"><span class="none"></span>Duplication</a></li>
<li><a href="pmd.html" title="PMD"><span class="none"></span>PMD</a></li>
<li class="nav-header">Apache</li>
<li><a href="http://www.apache.org" class="externalLink" title="Home"><span class="none"></span>Home</a></li>
<li><a href="http://www.apache.org/foundation/sponsorship.html" class="externalLink" title="Sponsorship"><span class="none"></span>Sponsorship</a></li>
<li><a href="http://www.apache.org/foundation/thanks.html" class="externalLink" title="Thanks"><span class="none"></span>Thanks</a></li>
<li><a href="https://www.apache.org/security/" class="externalLink" title="Security"><span class="none"></span>Security</a></li>
<li><a href="http://www.apachecon.com" class="externalLink" title="Conferences"><span class="none"></span>Conferences</a></li>
</ul>
</nav>
<div class="well sidebar-nav">
<hr />
<div id="poweredBy">
<div class="clear"></div>
<div class="clear"></div>
<div class="clear"></div>
<a href="http://maven.apache.org/" title="Built by Maven" class="poweredBy"><img class="builtBy" alt="Built by Maven" src="./images/logos/maven-feather.png" /></a>
</div>
</div>
</header>
<main id="bodyColumn" class="span10" >
<section>
<h2><a name="ZeroConf_-_Zero_Configuration"></a>ZeroConf - Zero Configuration</h2>
<p>Apache Chainsaw&#x2122; can use ZeroConf to discover advertised appenders and automatically configure a matching receiver, but you must update your configuration in order to advertise your appender via ZeroConf.</p>
<p>If you are using a newer version of log4j (1.2.16 or greater), most of the network-based appenders are capable of advertising their configurations via ZeroConf, but have this capability disabled by default. To advertise an appender via ZeroConf: [[1]] Download <a class="externalLink" href="http://sourceforge.net/projects/jmdns/">JmDNS</a></p>
<ol style="list-style-type: decimal">
<li>Add the <i>jmdns.jar</i> to your application's classpath</li>
<li>Modify your log4j configuration so that the appender is set to advertise its configuration via ZeroConf (by setting the 'advertiseViaMulticastDNS' parameter to 'true')</li></ol>
<p>Here is a complete log4j.xml file that you can use as a base SocketAppender configuration which advertises the appender via ZeroConf:<i>/p</i></p>
<div class="source"><pre class="prettyprint">&lt;log4j:configuration debug=&quot;false&quot; threshold=&quot;debug&quot; xmlns:log4j=&quot;http://jakarta.apache.org/log4j/&quot;&gt;
&lt;appender name=&quot;socketAppender&quot; class=&quot;org.apache.log4j.net.SocketAppender&quot;&gt;
&lt;param name=&quot;Name&quot; value=&quot;MySockeAppender&quot; /&gt;
&lt;param name=&quot;advertiseViaMulticastDNS&quot; value=&quot;true&quot; /&gt;
&lt;/appender&gt;
&lt;!--ROOT Logger--&gt;
&lt;root&gt;
&lt;level value=&quot;INFO&quot; /&gt;
&lt;appender-ref ref=&quot;socketAppender&quot; /&gt;
&lt;/root&gt;
&lt;/log4j:configuration&gt;</pre></div>
<p>If you are using an older version of log4j (prior to 1.2.16), ZeroConfSocketHubAppender is a ZeroConf-capable appender which is backward compatible with the prior versions of SocketHubAppender and can advertise the appender configuration via ZeroConf:<i>/p</i> [[1]] Download <a class="externalLink" href="http://sourceforge.net/projects/jmdns/">JmDNS</a></p>
<ol style="list-style-type: decimal">
<li>Add the <i>i</i>jmdns.jar<i>/i</i> to your application's classpath</li>
<li>Download <a class="externalLink" href="http://logging.apache.org/log4j/docs/webstart/chainsaw/log4j-zeroconf.zip">log4j ZeroConf extension (provides ZeroConfSocketHubAppender)</a></li>
<li>Add the <i>log4j-zeroconf.jar</i> to your application's classpath</li></ol>
<p>Here is a complete log4j.xml file that you can use as a base ZeroConfSocketAppender configuration which advertises the appender via ZeroConf:<i>/p</i></p>
<div class="source"><pre class="prettyprint">&lt;log4j:configuration debug=&quot;false&quot; threshold=&quot;debug&quot; xmlns:log4j=&quot;http://jakarta.apache.org/log4j/&quot;&gt;
&lt;appender name=&quot;zeroconf&quot; class=&quot;org.apache.log4j.net.ZeroConfSocketHubAppender&quot;&gt;
&lt;param name=&quot;Name&quot; value=&quot;MyZeroConfSockeHubAppender&quot; /&gt;
&lt;/appender&gt;
&lt;!--ROOT Logger--&gt;
&lt;root&gt;
&lt;level value=&quot;INFO&quot; /&gt;
&lt;appender-ref ref=&quot;zeroconf&quot; /&gt;
&lt;/root&gt;
&lt;/log4j:configuration&gt;</pre></div>
<p>Once you have enabled ZeroConf in your log4j configuration and started your application, you should be able to click on the Zeroconf tab inside Chainsaw and see the advertised appenders listed. If you double click on a row, Chainsaw will automatically connect to your application and start receiving events. You can tick the 'auto-connect' option to have Chainsaw immediately connect as soon as it sees your application started. Great for Dev/QA environment.<i>/p</i></p></section><section>
<h2><a name="Firewalls_Multicast_protocols_generally_don.27t_pass_through_firewall.2C_so_in_a_production_environment_Zeroconf_won.27t_work..2Fp"></a>Firewalls Multicast protocols generally don't pass through firewall, so in a production environment Zeroconf won't work.<i>/p</i></h2></section>
</main>
</div>
</div>
<hr/>
<footer>
<div class="container-fluid">
<div class="row-fluid">
<p>Copyright &#169; 2002&#x2013;2022<a href="https://www.apache.org/">The Apache Software Foundation</a>.
.</p>
</div>
</div>
</footer>
</body>
</html>