You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@logging.apache.org by Gary Gregory <ga...@gmail.com> on 2017/04/30 18:02:27 UTC

ConfiguratonFileWatcher and co

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: garydgregory@gmail.com | ggregory@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

Re: ConfiguratonFileWatcher and co

Posted by Gary Gregory <ga...@gmail.com>.
On May 1, 2017 11:04 AM, "Gary Gregory" <ga...@gmail.com> wrote:

Thank you, I'll give it a go.


Closing this thread to note that it worked.

Thank you Ralph!

Gary


Gary

On Sun, Apr 30, 2017 at 2:51 PM, Ralph Goers <ra...@dslextreme.com>
wrote:

> If it already is monitoring files, no. You can just add your FileWatcher.
> If it is not then you need to cause the monitoring interval to be set to a
> non-zero value.
>
> Ralph
>
> > On Apr 30, 2017, at 2:45 PM, Gary Gregory <ga...@gmail.com>
> wrote:
> >
> > Log4j is already up and going in my case. Do I need to reconfigure log4j?
> >
> > Gary
> >
> > On Apr 30, 2017 1:40 PM, "Ralph Goers" <ra...@dslextreme.com>
> wrote:
> >
> >> 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 <ga...@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.goers@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 <ga...@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: garydgregory@gmail.com | ggregory@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=cadb800f39946ec62ea2b1af9fe6a2
> >> b8>
> >>>>>
> >>>>> <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=31ecd1f6b6d1eaf8886ac902a24de4
> >> 18%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: garydgregory@gmail.com | ggregory@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=cadb800f39946ec62ea2b
> 1af9fe6a2b8>
> >>>
> >>> <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=31ecd1f6b6d1eaf8886ac
> 902a24de418%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: garydgregory@gmail.com | ggregory@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

Re: ConfiguratonFileWatcher and co

Posted by Gary Gregory <ga...@gmail.com>.
Thank you, I'll give it a go.

Gary

On Sun, Apr 30, 2017 at 2:51 PM, Ralph Goers <ra...@dslextreme.com>
wrote:

> If it already is monitoring files, no. You can just add your FileWatcher.
> If it is not then you need to cause the monitoring interval to be set to a
> non-zero value.
>
> Ralph
>
> > On Apr 30, 2017, at 2:45 PM, Gary Gregory <ga...@gmail.com>
> wrote:
> >
> > Log4j is already up and going in my case. Do I need to reconfigure log4j?
> >
> > Gary
> >
> > On Apr 30, 2017 1:40 PM, "Ralph Goers" <ra...@dslextreme.com>
> wrote:
> >
> >> 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 <ga...@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.goers@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 <ga...@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: garydgregory@gmail.com | ggregory@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=cadb800f39946ec62ea2b1af9fe6a2
> >> b8>
> >>>>>
> >>>>> <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=31ecd1f6b6d1eaf8886ac902a24de4
> >> 18%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: garydgregory@gmail.com | ggregory@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=cadb800f39946ec62ea2b1af9fe6a2
> b8>
> >>>
> >>> <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=31ecd1f6b6d1eaf8886ac902a24de4
> 18%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: garydgregory@gmail.com | ggregory@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

Re: ConfiguratonFileWatcher and co

Posted by Ralph Goers <ra...@dslextreme.com>.
If it already is monitoring files, no. You can just add your FileWatcher. If it is not then you need to cause the monitoring interval to be set to a non-zero value.

Ralph

> On Apr 30, 2017, at 2:45 PM, Gary Gregory <ga...@gmail.com> wrote:
> 
> Log4j is already up and going in my case. Do I need to reconfigure log4j?
> 
> Gary
> 
> On Apr 30, 2017 1:40 PM, "Ralph Goers" <ra...@dslextreme.com> wrote:
> 
>> 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 <ga...@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.goers@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 <ga...@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: garydgregory@gmail.com | ggregory@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=cadb800f39946ec62ea2b1af9fe6a2
>> b8>
>>>>> 
>>>>> <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=31ecd1f6b6d1eaf8886ac902a24de4
>> 18%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: garydgregory@gmail.com | ggregory@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
>> 
>> 



Re: ConfiguratonFileWatcher and co

Posted by Gary Gregory <ga...@gmail.com>.
Log4j is already up and going in my case. Do I need to reconfigure log4j?

Gary

On Apr 30, 2017 1:40 PM, "Ralph Goers" <ra...@dslextreme.com> wrote:

> 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 <ga...@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.goers@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 <ga...@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: garydgregory@gmail.com | ggregory@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=cadb800f39946ec62ea2b1af9fe6a2
> b8>
> >>>
> >>> <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=31ecd1f6b6d1eaf8886ac902a24de4
> 18%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: garydgregory@gmail.com | ggregory@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
>
>

Re: ConfiguratonFileWatcher and co

Posted by Ralph Goers <ra...@dslextreme.com>.
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 <ga...@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 <ra...@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 <ga...@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: garydgregory@gmail.com | ggregory@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: garydgregory@gmail.com | ggregory@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


Re: ConfiguratonFileWatcher and co

Posted by Gary Gregory <ga...@gmail.com>.
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 <ra...@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 <ga...@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: garydgregory@gmail.com | ggregory@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: garydgregory@gmail.com | ggregory@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

Re: ConfiguratonFileWatcher and co

Posted by Ralph Goers <ra...@dslextreme.com>.
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 <ga...@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: garydgregory@gmail.com | ggregory@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