Bug 52765 - ZeroConf does not work
Summary: ZeroConf does not work
Status: NEW
Alias: None
Product: Log4j - Now in Jira
Classification: Unclassified
Component: chainsaw (show other bugs)
Version: unspecified
Hardware: PC Linux
: P2 blocker
Target Milestone: ---
Assignee: log4j-dev
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-02-25 03:25 UTC by Charles Strahan
Modified: 2012-02-28 06:12 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Charles Strahan 2012-02-25 03:25:57 UTC
There are a couple aspects of this problem for me to address, so here we go. This report is based on the latest trunk of Chainsaw as of earlier today (should be revision 1178454), on Ubuntu 11.04.

First of all, the old 2006 binary (found here: http://logging.apache.org/chainsaw/download.html) is capable of detecting appenders registered with a type of _log4j._tcp.local. This is no longer so in the latest revision (although it doesn't really hold me back, personally). I think (per this ticket: https://issues.apache.org/bugzilla/show_bug.cgi?id=48907) that _log4j._tcp.local. was supposed to be supported for backwards compatibility with the ZeroConfSocketHubAppender.

Secondly, I don't think that the ZONEs are formatted correctly for the other appenders/receivers, nor in ZeroConfPlugin.java. For example, I believe that this:

_log4j_xml_udp_appender.local.

should be:

_log4j_xml_udp_appender._udp.local.

Note the missing `._udp'. I'm not terribly familiar with ZeroConf/mDNS/Bonjour/whatever, but I do believe that the protocol (tcp or udp) is required as part of the registration. Concretely, if I make the suggested change and then try the following ruby code, the appender is correctly configured in Chainsaw:

  require 'dnssd'
  
  name = "My log4j appender"
  type = "_log4j_xml_udp_appender._udp"
  domain = nil
  port = 3689
  
  DNSSD.register(name, type, domain, port)
  
  puts "Press enter to exit . . ."
  gets


If I wasn't clueless about Java development, I'd give fixing this a shot...

-Charles
Comment 1 Scott Deboy 2012-02-25 21:49:51 UTC
All of the network appenders and receiver now can advertise via Multicast DNS (which isn't as restrictive when it comes to advertised names as Bounjour) via a setting in the configuration, so the ZeroConf sockethub appender is no longer necessary.

I don't mind making the change to be consistent with Bounjour naming requirements - it isn't technically required -advertising and discovery works fine with appenders and Chainsaw - but if others have tools which use Bonjour, I don't mind adding the protocol into the names.
Comment 2 Scott Deboy 2012-02-25 22:10:27 UTC
I think I'll just make the multicast dns names configurable (with a reasonable default).
Comment 3 Charles Strahan 2012-02-28 03:58:31 UTC
Hey Scott,

I see - so it isn't that Chainsaw has any problems, it's just that my Ruby library implements Bonjour as opposed to mDNS, which means I have to specify a protocol (TCP or UDP)... and Chainsaw isn't expecting that.

Perhaps Chainsaw could support both the less restrictive names _and_ the the names + protocol, if that wouldn't be impractical and/or a pain in the ass.

If you're curious, I thought it would be nice to have Chainsaw to view my Rails logs (I already implemented the appropriate XML formatting in Log4r a while back). In fact, I thought it would be cool to be able to share a snippet of code with some of my buddies that would handle both the broadcasting of log messages _and_ the mDNS/Bondjour registration, so they could leverage the awesomeness that is Chainsaw without having to bother with manually configuring both ends.


My apologies for taking so long to reply - I just moved 1000 miles from Dallas, TX to Washington, DC. Thanks for your help!

-Charles
Comment 4 Scott Deboy 2012-02-28 06:12:06 UTC
I think it'll be fine to just use bonjour style names.  I'm not sure supporting configurable names would be useful - if someone requests it I'll add it in the future.  This will require an update to log4j itself partially (at least the core socket appenders) as well as Chainsaw.  I'll see if I can get a commit in sometime this week..

By the way, if you feel like trying out the latest developer snapshot of Chainsaw is available at http://people.apache.org/~sdeboy - there are a ton of new features.

(feedback always welcome)

Scott