projecthydra/jettywrapper — pull request #5 by cbeer (2011-11-28 23:06:00+00:00)
Title: Listen to the jetty log to figure out when it is ready and listening

Right now, `Jettywrapper` accepts a `:startup_wait` parameter, which causes `Jettywrapper` to wait X seconds before continuing (and sometimes jetty takes longer than X seconds and things break, or jetty takes shorter and we're left sitting around waiting needlessly).

This patch (which is probably not ready for merging yet) adds the option to :startup_wait to watch the `jettywrapper.log` file to determine when Jetty is ready for requests before continuing. By default, the legacy behavior is used, but if `startup_wait` is `true` it does the fancy new thing.

The problem with this patch, and what I'm looking for feedback/advice on, is that it only works when `Jettywrapper` is logging to a file (which it does in quiet mode, the default), but will not work in "loud" mode where output is piped directly to `$stderr`.

As I see it, there are a couple of options:

1) figure out some clever way of tapping into the jetty STDERR to add the monitoring step appropriately. I've tried a couple approaches already and I'm not sure how successful this option will be.

2) Remove "loud" mode and always log to jettywrapper.log

3) If the user requests both loud mode and the new listening feature, raise an error or wait the default time. In this option, we'd only support the new listening feature if we log to a file.