You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@logging.apache.org by Matt Sicker <bo...@gmail.com> on 2017/07/17 04:06:34 UTC

Re: logging-log4j2 git commit: Rename ConfigurationStoppingAware to ConfigurationStopAware since we are piggy backing a stop() method at some point up the call stack.

Maybe ConfigurationLifecycleAware or something?

On 16 July 2017 at 22:18, <gg...@apache.org> wrote:

> Repository: logging-log4j2
> Updated Branches:
>   refs/heads/LOG4J2-1949 28fb868a0 -> 19a59e680
>
>
> Rename ConfigurationStoppingAware to ConfigurationStopAware since we are
> piggy backing a stop() method at some point up the call stack.
>
> Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
> Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/
> commit/19a59e68
> Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/19a59e68
> Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/19a59e68
>
> Branch: refs/heads/LOG4J2-1949
> Commit: 19a59e6805711c8b0367486232172b027db6051f
> Parents: 28fb868
> Author: Gary Gregory <gg...@apache.org>
> Authored: Sun Jul 16 20:18:05 2017 -0700
> Committer: Gary Gregory <gg...@apache.org>
> Committed: Sun Jul 16 20:18:05 2017 -0700
>
> ----------------------------------------------------------------------
>  .../log4j/core/appender/FailoverAppender.java   |  4 +--
>  .../core/config/AbstractConfiguration.java      |  4 +--
>  .../core/config/ConfigurationStopAware.java     | 28 ++++++++++++++++++++
>  .../core/config/ConfigurationStoppingAware.java | 28 --------------------
>  .../config/ConfigurationStoppingAwareTest.java  |  2 +-
>  5 files changed, 33 insertions(+), 33 deletions(-)
> ----------------------------------------------------------------------
>
>
> http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/
> 19a59e68/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/
> FailoverAppender.java
> ----------------------------------------------------------------------
> diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/FailoverAppender.java
> b/log4j-core/src/main/java/org/apache/logging/log4j/core/
> appender/FailoverAppender.java
> index 505cb2c..a46d6fc 100644
> --- a/log4j-core/src/main/java/org/apache/logging/log4j/core/
> appender/FailoverAppender.java
> +++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/
> appender/FailoverAppender.java
> @@ -30,7 +30,7 @@ import org.apache.logging.log4j.core.Filter;
>  import org.apache.logging.log4j.core.LogEvent;
>  import org.apache.logging.log4j.core.config.AppenderControl;
>  import org.apache.logging.log4j.core.config.Configuration;
> -import org.apache.logging.log4j.core.config.ConfigurationStoppingAware;
> +import org.apache.logging.log4j.core.config.ConfigurationStopAware;
>  import org.apache.logging.log4j.core.config.plugins.Plugin;
>  import org.apache.logging.log4j.core.config.plugins.PluginAliases;
>  import org.apache.logging.log4j.core.config.plugins.PluginAttribute;
> @@ -46,7 +46,7 @@ import org.apache.logging.log4j.core.util.Constants;
>   * to not suppress exceptions for the FailoverAppender to work.
>   */
>  @Plugin(name = "Failover", category = Core.CATEGORY_NAME, elementType =
> Appender.ELEMENT_TYPE, printObject = true)
> -public final class FailoverAppender extends AbstractAppender implements
> ConfigurationStoppingAware {
> +public final class FailoverAppender extends AbstractAppender implements
> ConfigurationStopAware {
>
>      private static final int DEFAULT_INTERVAL_SECONDS = 60;
>
>
> http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/
> 19a59e68/log4j-core/src/main/java/org/apache/logging/log4j/core/config/
> AbstractConfiguration.java
> ----------------------------------------------------------------------
> diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/
> config/AbstractConfiguration.java b/log4j-core/src/main/java/
> org/apache/logging/log4j/core/config/AbstractConfiguration.java
> index 2c75a91..d272805 100644
> --- a/log4j-core/src/main/java/org/apache/logging/log4j/core/
> config/AbstractConfiguration.java
> +++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/
> config/AbstractConfiguration.java
> @@ -285,8 +285,8 @@ public abstract class AbstractConfiguration extends
> AbstractFilterable implement
>
>      private void beforeStop() {
>          for (Appender appender : appenders.values()) {
> -            if (appender instanceof ConfigurationStoppingAware) {
> -                ((ConfigurationStoppingAware) appender).
> beforeStopConfiguration();
> +            if (appender instanceof ConfigurationStopAware) {
> +                ((ConfigurationStopAware) appender).
> beforeStopConfiguration();
>              }
>          }
>      }
>
> http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/
> 19a59e68/log4j-core/src/main/java/org/apache/logging/log4j/core/config/
> ConfigurationStopAware.java
> ----------------------------------------------------------------------
> diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/
> config/ConfigurationStopAware.java b/log4j-core/src/main/java/
> org/apache/logging/log4j/core/config/ConfigurationStopAware.java
> new file mode 100644
> index 0000000..a4310dd
> --- /dev/null
> +++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/
> config/ConfigurationStopAware.java
> @@ -0,0 +1,28 @@
> +/*
> + * Licensed to the Apache Software Foundation (ASF) under one or more
> + * contributor license agreements. See the NOTICE file distributed with
> + * this work for additional information regarding copyright ownership.
> + * The ASF licenses this file to You under the Apache license, Version 2.0
> + * (the "License"); you may not use this file except in compliance with
> + * the License. You may obtain a copy of the License at
> + *
> + *      http://www.apache.org/licenses/LICENSE-2.0
> + *
> + * Unless required by applicable law or agreed to in writing, software
> + * distributed under the License is distributed on an "AS IS" BASIS,
> + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
> implied.
> + * See the license for the specific language governing permissions and
> + * limitations under the license.
> + */
> +package org.apache.logging.log4j.core.config;
> +
> +/**
> + * Implementing appenders will be notified when the configuration is
> preparing to stop, but not actually stopped.
> + */
> +public interface ConfigurationStopAware {
> +
> +    /**
> +     * Invoked when the configuration is preparing to stop, but not
> actually stopped.
> +     */
> +    void beforeStopConfiguration();
> +}
>
> http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/
> 19a59e68/log4j-core/src/main/java/org/apache/logging/log4j/core/config/
> ConfigurationStoppingAware.java
> ----------------------------------------------------------------------
> diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/
> config/ConfigurationStoppingAware.java b/log4j-core/src/main/java/
> org/apache/logging/log4j/core/config/ConfigurationStoppingAware.java
> deleted file mode 100644
> index 514e887..0000000
> --- a/log4j-core/src/main/java/org/apache/logging/log4j/core/config/
> ConfigurationStoppingAware.java
> +++ /dev/null
> @@ -1,28 +0,0 @@
> -/*
> - * Licensed to the Apache Software Foundation (ASF) under one or more
> - * contributor license agreements. See the NOTICE file distributed with
> - * this work for additional information regarding copyright ownership.
> - * The ASF licenses this file to You under the Apache license, Version 2.0
> - * (the "License"); you may not use this file except in compliance with
> - * the License. You may obtain a copy of the License at
> - *
> - *      http://www.apache.org/licenses/LICENSE-2.0
> - *
> - * Unless required by applicable law or agreed to in writing, software
> - * distributed under the License is distributed on an "AS IS" BASIS,
> - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
> implied.
> - * See the license for the specific language governing permissions and
> - * limitations under the license.
> - */
> -package org.apache.logging.log4j.core.config;
> -
> -/**
> - * Implementing appenders will be notified when the configuration is
> preparing to stop, but not actually stopped.
> - */
> -public interface ConfigurationStoppingAware {
> -
> -    /**
> -     * Invoked when the configuration is preparing to stop, but not
> actually stopped.
> -     */
> -    void beforeStopConfiguration();
> -}
>
> http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/
> 19a59e68/log4j-core/src/test/java/org/apache/logging/log4j/core/config/
> ConfigurationStoppingAwareTest.java
> ----------------------------------------------------------------------
> diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/core/
> config/ConfigurationStoppingAwareTest.java b/log4j-core/src/test/java/
> org/apache/logging/log4j/core/config/ConfigurationStoppingAwareTest.java
> index 5e65a02..43f5a89 100644
> --- a/log4j-core/src/test/java/org/apache/logging/log4j/core/config/
> ConfigurationStoppingAwareTest.java
> +++ b/log4j-core/src/test/java/org/apache/logging/log4j/core/config/
> ConfigurationStoppingAwareTest.java
> @@ -91,7 +91,7 @@ public class ConfigurationStoppingAwareTest
>
>      }
>
> -    private static class AppenderTester implements Appender,
> ConfigurationStoppingAware {
> +    private static class AppenderTester implements Appender,
> ConfigurationStopAware {
>
>          private final String name;
>          private boolean started = false;
>
>


-- 
Matt Sicker <bo...@gmail.com>

Re: logging-log4j2 git commit: Rename ConfigurationStoppingAware to ConfigurationStopAware since we are piggy backing a stop() method at some point up the call stack.

Posted by Gary Gregory <ga...@gmail.com>.
Yeah, could be.

I just started looking at this patch/branch.

I am wondering if we can reuse our {{LifeCyle}} and {{LifeCycle2}}
interfaces instead of creating new interfaces like
{{ConfigurationStoppingAware}}.

Something like {{ConfigurationStoppingAware}} seems mighty specific. It is
indeed well-named since it does only one thing. But you could see it also
as {{ConfigurationLifeCyle}}, but then why not just {{LifeCycle}}

I've been renaming a few things as you can see.

I would appreciate a 2nd pair of eyes. I would not hold up 2.9 though.

Gary


On Sun, Jul 16, 2017 at 9:06 PM, Matt Sicker <bo...@gmail.com> wrote:

> Maybe ConfigurationLifecycleAware or something?
>
> On 16 July 2017 at 22:18, <gg...@apache.org> wrote:
>
> > Repository: logging-log4j2
> > Updated Branches:
> >   refs/heads/LOG4J2-1949 28fb868a0 -> 19a59e680
> >
> >
> > Rename ConfigurationStoppingAware to ConfigurationStopAware since we are
> > piggy backing a stop() method at some point up the call stack.
> >
> > Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
> > Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/
> > commit/19a59e68
> > Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/
> 19a59e68
> > Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/
> 19a59e68
> >
> > Branch: refs/heads/LOG4J2-1949
> > Commit: 19a59e6805711c8b0367486232172b027db6051f
> > Parents: 28fb868
> > Author: Gary Gregory <gg...@apache.org>
> > Authored: Sun Jul 16 20:18:05 2017 -0700
> > Committer: Gary Gregory <gg...@apache.org>
> > Committed: Sun Jul 16 20:18:05 2017 -0700
> >
> > ----------------------------------------------------------------------
> >  .../log4j/core/appender/FailoverAppender.java   |  4 +--
> >  .../core/config/AbstractConfiguration.java      |  4 +--
> >  .../core/config/ConfigurationStopAware.java     | 28
> ++++++++++++++++++++
> >  .../core/config/ConfigurationStoppingAware.java | 28
> --------------------
> >  .../config/ConfigurationStoppingAwareTest.java  |  2 +-
> >  5 files changed, 33 insertions(+), 33 deletions(-)
> > ----------------------------------------------------------------------
> >
> >
> > http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/
> > 19a59e68/log4j-core/src/main/java/org/apache/logging/log4j/
> core/appender/
> > FailoverAppender.java
> > ----------------------------------------------------------------------
> > diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/
> appender/FailoverAppender.java
> > b/log4j-core/src/main/java/org/apache/logging/log4j/core/
> > appender/FailoverAppender.java
> > index 505cb2c..a46d6fc 100644
> > --- a/log4j-core/src/main/java/org/apache/logging/log4j/core/
> > appender/FailoverAppender.java
> > +++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/
> > appender/FailoverAppender.java
> > @@ -30,7 +30,7 @@ import org.apache.logging.log4j.core.Filter;
> >  import org.apache.logging.log4j.core.LogEvent;
> >  import org.apache.logging.log4j.core.config.AppenderControl;
> >  import org.apache.logging.log4j.core.config.Configuration;
> > -import org.apache.logging.log4j.core.config.ConfigurationStoppingAware;
> > +import org.apache.logging.log4j.core.config.ConfigurationStopAware;
> >  import org.apache.logging.log4j.core.config.plugins.Plugin;
> >  import org.apache.logging.log4j.core.config.plugins.PluginAliases;
> >  import org.apache.logging.log4j.core.config.plugins.PluginAttribute;
> > @@ -46,7 +46,7 @@ import org.apache.logging.log4j.core.util.Constants;
> >   * to not suppress exceptions for the FailoverAppender to work.
> >   */
> >  @Plugin(name = "Failover", category = Core.CATEGORY_NAME, elementType =
> > Appender.ELEMENT_TYPE, printObject = true)
> > -public final class FailoverAppender extends AbstractAppender implements
> > ConfigurationStoppingAware {
> > +public final class FailoverAppender extends AbstractAppender implements
> > ConfigurationStopAware {
> >
> >      private static final int DEFAULT_INTERVAL_SECONDS = 60;
> >
> >
> > http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/
> > 19a59e68/log4j-core/src/main/java/org/apache/logging/log4j/core/config/
> > AbstractConfiguration.java
> > ----------------------------------------------------------------------
> > diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/
> > config/AbstractConfiguration.java b/log4j-core/src/main/java/
> > org/apache/logging/log4j/core/config/AbstractConfiguration.java
> > index 2c75a91..d272805 100644
> > --- a/log4j-core/src/main/java/org/apache/logging/log4j/core/
> > config/AbstractConfiguration.java
> > +++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/
> > config/AbstractConfiguration.java
> > @@ -285,8 +285,8 @@ public abstract class AbstractConfiguration extends
> > AbstractFilterable implement
> >
> >      private void beforeStop() {
> >          for (Appender appender : appenders.values()) {
> > -            if (appender instanceof ConfigurationStoppingAware) {
> > -                ((ConfigurationStoppingAware) appender).
> > beforeStopConfiguration();
> > +            if (appender instanceof ConfigurationStopAware) {
> > +                ((ConfigurationStopAware) appender).
> > beforeStopConfiguration();
> >              }
> >          }
> >      }
> >
> > http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/
> > 19a59e68/log4j-core/src/main/java/org/apache/logging/log4j/core/config/
> > ConfigurationStopAware.java
> > ----------------------------------------------------------------------
> > diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/
> > config/ConfigurationStopAware.java b/log4j-core/src/main/java/
> > org/apache/logging/log4j/core/config/ConfigurationStopAware.java
> > new file mode 100644
> > index 0000000..a4310dd
> > --- /dev/null
> > +++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/
> > config/ConfigurationStopAware.java
> > @@ -0,0 +1,28 @@
> > +/*
> > + * Licensed to the Apache Software Foundation (ASF) under one or more
> > + * contributor license agreements. See the NOTICE file distributed with
> > + * this work for additional information regarding copyright ownership.
> > + * The ASF licenses this file to You under the Apache license, Version
> 2.0
> > + * (the "License"); you may not use this file except in compliance with
> > + * the License. You may obtain a copy of the License at
> > + *
> > + *      http://www.apache.org/licenses/LICENSE-2.0
> > + *
> > + * Unless required by applicable law or agreed to in writing, software
> > + * distributed under the License is distributed on an "AS IS" BASIS,
> > + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
> > implied.
> > + * See the license for the specific language governing permissions and
> > + * limitations under the license.
> > + */
> > +package org.apache.logging.log4j.core.config;
> > +
> > +/**
> > + * Implementing appenders will be notified when the configuration is
> > preparing to stop, but not actually stopped.
> > + */
> > +public interface ConfigurationStopAware {
> > +
> > +    /**
> > +     * Invoked when the configuration is preparing to stop, but not
> > actually stopped.
> > +     */
> > +    void beforeStopConfiguration();
> > +}
> >
> > http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/
> > 19a59e68/log4j-core/src/main/java/org/apache/logging/log4j/core/config/
> > ConfigurationStoppingAware.java
> > ----------------------------------------------------------------------
> > diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/
> > config/ConfigurationStoppingAware.java b/log4j-core/src/main/java/
> > org/apache/logging/log4j/core/config/ConfigurationStoppingAware.java
> > deleted file mode 100644
> > index 514e887..0000000
> > --- a/log4j-core/src/main/java/org/apache/logging/log4j/core/config/
> > ConfigurationStoppingAware.java
> > +++ /dev/null
> > @@ -1,28 +0,0 @@
> > -/*
> > - * Licensed to the Apache Software Foundation (ASF) under one or more
> > - * contributor license agreements. See the NOTICE file distributed with
> > - * this work for additional information regarding copyright ownership.
> > - * The ASF licenses this file to You under the Apache license, Version
> 2.0
> > - * (the "License"); you may not use this file except in compliance with
> > - * the License. You may obtain a copy of the License at
> > - *
> > - *      http://www.apache.org/licenses/LICENSE-2.0
> > - *
> > - * Unless required by applicable law or agreed to in writing, software
> > - * distributed under the License is distributed on an "AS IS" BASIS,
> > - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
> > implied.
> > - * See the license for the specific language governing permissions and
> > - * limitations under the license.
> > - */
> > -package org.apache.logging.log4j.core.config;
> > -
> > -/**
> > - * Implementing appenders will be notified when the configuration is
> > preparing to stop, but not actually stopped.
> > - */
> > -public interface ConfigurationStoppingAware {
> > -
> > -    /**
> > -     * Invoked when the configuration is preparing to stop, but not
> > actually stopped.
> > -     */
> > -    void beforeStopConfiguration();
> > -}
> >
> > http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/
> > 19a59e68/log4j-core/src/test/java/org/apache/logging/log4j/core/config/
> > ConfigurationStoppingAwareTest.java
> > ----------------------------------------------------------------------
> > diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/core/
> > config/ConfigurationStoppingAwareTest.java b/log4j-core/src/test/java/
> > org/apache/logging/log4j/core/config/ConfigurationStoppingAwareTest.java
> > index 5e65a02..43f5a89 100644
> > --- a/log4j-core/src/test/java/org/apache/logging/log4j/core/config/
> > ConfigurationStoppingAwareTest.java
> > +++ b/log4j-core/src/test/java/org/apache/logging/log4j/core/config/
> > ConfigurationStoppingAwareTest.java
> > @@ -91,7 +91,7 @@ public class ConfigurationStoppingAwareTest
> >
> >      }
> >
> > -    private static class AppenderTester implements Appender,
> > ConfigurationStoppingAware {
> > +    private static class AppenderTester implements Appender,
> > ConfigurationStopAware {
> >
> >          private final String name;
> >          private boolean started = false;
> >
> >
>
>
> --
> Matt Sicker <bo...@gmail.com>
>