A WatchManager is always present. You don’t want to create another one. It just isn’t started if watchManager.getIntervalSeconds() returns zero. All you really have to do is
WatchManager manager = configuration.getWatchManager(); If (manager.getIntervalSeconds == 0) { manager.setIntervalSeconds(interval); } manager.watchFile(myFile, myFileWatcher); The only trick is that you have to set the interval before the configuration is started. You can call manager.watchFile any time. Ralph > On Apr 30, 2017, at 12:03 PM, Gary Gregory <garydgreg...@gmail.com> wrote: > > Cool. > > If Log4j is NOT set up to monitor it's config file or if I want a different > monitor interface, I can just build a WatchManager with > a ConfigurationScheduler? > > Gary > > On Sun, Apr 30, 2017 at 11:09 AM, Ralph Goers <ralph.go...@dslextreme.com> > wrote: > >> It already is generic. All you have to do is get the WatchManager from the >> Configuration and then call watchFile passing the File and the FileWatcher. >> >> Ralph >> >>> On Apr 30, 2017, at 11:02 AM, Gary Gregory <garydgreg...@gmail.com> >> wrote: >>> >>> Hi, >>> >>> I was hoping I can reuse some of ConfiguratonFileWatcher and co to watch >> my >>> own files but I cannot ATM, which is understandable of course. >>> >>> I was considering making this code a little more generic so that any one >>> could watch their files. >>> >>> Thoughts? >>> >>> Gary >>> >>> -- >>> E-Mail: garydgreg...@gmail.com | ggreg...@apache.org >>> Java Persistence with Hibernate, Second Edition >>> <https://www.amazon.com/gp/product/1617290459/ref=as_li_ >> tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=1617290459& >> linkCode=as2&tag=garygregory-20&linkId=cadb800f39946ec62ea2b1af9fe6a2b8> >>> >>> <http:////ir-na.amazon-adsystem.com/e/ir?t=garygregory-20&l=am2&o=1&a= >> 1617290459> >>> JUnit in Action, Second Edition >>> <https://www.amazon.com/gp/product/1935182021/ref=as_li_ >> tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=1935182021& >> linkCode=as2&tag=garygregory-20&linkId=31ecd1f6b6d1eaf8886ac902a24de418%22 >>> >>> >>> <http:////ir-na.amazon-adsystem.com/e/ir?t=garygregory-20&l=am2&o=1&a= >> 1935182021> >>> Spring Batch in Action >>> <https://www.amazon.com/gp/product/1935182951/ref=as_li_ >> tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=1935182951& >> linkCode=%7B%7BlinkCode%7D%7D&tag=garygregory-20&linkId=%7B% >> 7Blink_id%7D%7D%22%3ESpring+Batch+in+Action> >>> <http:////ir-na.amazon-adsystem.com/e/ir?t=garygregory-20&l=am2&o=1&a= >> 1935182951> >>> Blog: http://garygregory.wordpress.com >>> Home: http://garygregory.com/ >>> Tweet! http://twitter.com/GaryGregory >> >> >> > > > -- > E-Mail: garydgreg...@gmail.com | ggreg...@apache.org > Java Persistence with Hibernate, Second Edition > <https://www.amazon.com/gp/product/1617290459/ref=as_li_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=1617290459&linkCode=as2&tag=garygregory-20&linkId=cadb800f39946ec62ea2b1af9fe6a2b8> > > <http:////ir-na.amazon-adsystem.com/e/ir?t=garygregory-20&l=am2&o=1&a=1617290459> > JUnit in Action, Second Edition > <https://www.amazon.com/gp/product/1935182021/ref=as_li_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=1935182021&linkCode=as2&tag=garygregory-20&linkId=31ecd1f6b6d1eaf8886ac902a24de418%22> > > <http:////ir-na.amazon-adsystem.com/e/ir?t=garygregory-20&l=am2&o=1&a=1935182021> > Spring Batch in Action > <https://www.amazon.com/gp/product/1935182951/ref=as_li_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=1935182951&linkCode=%7B%7BlinkCode%7D%7D&tag=garygregory-20&linkId=%7B%7Blink_id%7D%7D%22%3ESpring+Batch+in+Action> > <http:////ir-na.amazon-adsystem.com/e/ir?t=garygregory-20&l=am2&o=1&a=1935182951> > Blog: http://garygregory.wordpress.com > Home: http://garygregory.com/ > Tweet! http://twitter.com/GaryGregory