You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-dev@logging.apache.org by Remko Popma <re...@gmail.com> on 2016/11/19 04:10:47 UTC

Re: [1/2] logging-log4j2 git commit: Add org.apache.logging.log4j.core.AbstractLifeCycle.getLogger()

Why? I prefer to keep the constant: that makes it clearer that this is a status logger for internal use. 

Sent from my iPhone

> On 19 Nov 2016, at 3:54, ggregory@apache.org wrote:
> 
> Repository: logging-log4j2
> Updated Branches:
>  refs/heads/master 551cf8399 -> ee6f50d4c
> 
> 
> Add org.apache.logging.log4j.core.AbstractLifeCycle.getLogger()
> 
> Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
> Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/261aba82
> Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/261aba82
> Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/261aba82
> 
> Branch: refs/heads/master
> Commit: 261aba82b77f9f7fa6fe049d8f38a9311e442d89
> Parents: b5662cf
> Author: Gary Gregory <gg...@apache.org>
> Authored: Fri Nov 18 10:53:35 2016 -0800
> Committer: Gary Gregory <gg...@apache.org>
> Committed: Fri Nov 18 10:53:35 2016 -0800
> 
> ----------------------------------------------------------------------
> .../org/apache/logging/log4j/core/AbstractLifeCycle.java    | 9 +++++++++
> 1 file changed, 9 insertions(+)
> ----------------------------------------------------------------------
> 
> 
> http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/261aba82/log4j-core/src/main/java/org/apache/logging/log4j/core/AbstractLifeCycle.java
> ----------------------------------------------------------------------
> diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/AbstractLifeCycle.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/AbstractLifeCycle.java
> index dc720fd..c2df135 100644
> --- a/log4j-core/src/main/java/org/apache/logging/log4j/core/AbstractLifeCycle.java
> +++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/AbstractLifeCycle.java
> @@ -37,6 +37,15 @@ public class AbstractLifeCycle implements LifeCycle2 {
>      */
>     protected static final org.apache.logging.log4j.Logger LOGGER = StatusLogger.getLogger();
> 
> +    /**
> +     * Gets the status logger.
> +     * 
> +     * @return the status logger.
> +     */
> +    protected static org.apache.logging.log4j.Logger getLogger() {
> +        return LOGGER;
> +    }
> +
>     private volatile LifeCycle.State state = LifeCycle.State.INITIALIZED;
> 
>     protected boolean equalsImpl(final Object obj) {
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org


Re: [1/2] logging-log4j2 git commit: Add org.apache.logging.log4j.core.AbstractLifeCycle.getLogger()

Posted by Remko Popma <re...@gmail.com>.
If StatusLogger.getLogger () returns a cached instance, a static import seems the cleanest solution. 
I do like the name getStatusLogger() better, especially when the StatusLogger prefix is hidden by the static import. 

Sent from my iPhone

> On 19 Nov 2016, at 17:26, Matt Sicker <bo...@gmail.com> wrote:
> 
> I can never remember when a class inherits a StatusLogger anyways, so it generally seems a bit easier to just add the static field when used.
> 
>> On 18 November 2016 at 22:15, Gary Gregory <ga...@gmail.com> wrote:
>> But... from a provider's POV, like when I implement a custom Appender, it seems cleaner and more OO to call getLogger() than to access the static var directly. Now that I think about it, calling it getStatusLogger() would be even better. 
>> 
>> WDYT?
>> 
>> Gary
>> 
>> 
>>> On Fri, Nov 18, 2016 at 8:10 PM, Remko Popma <re...@gmail.com> wrote:
>>> Why? I prefer to keep the constant: that makes it clearer that this is a status logger for internal use.
>>> 
>>> Sent from my iPhone
>>> 
>>> > On 19 Nov 2016, at 3:54, ggregory@apache.org wrote:
>>> >
>>> > Repository: logging-log4j2
>>> > Updated Branches:
>>> >  refs/heads/master 551cf8399 -> ee6f50d4c
>>> >
>>> >
>>> > Add org.apache.logging.log4j.core.AbstractLifeCycle.getLogger()
>>> >
>>> > Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
>>> > Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/261aba82
>>> > Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/261aba82
>>> > Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/261aba82
>>> >
>>> > Branch: refs/heads/master
>>> > Commit: 261aba82b77f9f7fa6fe049d8f38a9311e442d89
>>> > Parents: b5662cf
>>> > Author: Gary Gregory <gg...@apache.org>
>>> > Authored: Fri Nov 18 10:53:35 2016 -0800
>>> > Committer: Gary Gregory <gg...@apache.org>
>>> > Committed: Fri Nov 18 10:53:35 2016 -0800
>>> >
>>> > ----------------------------------------------------------------------
>>> > .../org/apache/logging/log4j/core/AbstractLifeCycle.java    | 9 +++++++++
>>> > 1 file changed, 9 insertions(+)
>>> > ----------------------------------------------------------------------
>>> >
>>> >
>>> > http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/261aba82/log4j-core/src/main/java/org/apache/logging/log4j/core/AbstractLifeCycle.java
>>> > ----------------------------------------------------------------------
>>> > diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/AbstractLifeCycle.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/AbstractLifeCycle.java
>>> > index dc720fd..c2df135 100644
>>> > --- a/log4j-core/src/main/java/org/apache/logging/log4j/core/AbstractLifeCycle.java
>>> > +++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/AbstractLifeCycle.java
>>> > @@ -37,6 +37,15 @@ public class AbstractLifeCycle implements LifeCycle2 {
>>> >      */
>>> >     protected static final org.apache.logging.log4j.Logger LOGGER = StatusLogger.getLogger();
>>> >
>>> > +    /**
>>> > +     * Gets the status logger.
>>> > +     *
>>> > +     * @return the status logger.
>>> > +     */
>>> > +    protected static org.apache.logging.log4j.Logger getLogger() {
>>> > +        return LOGGER;
>>> > +    }
>>> > +
>>> >     private volatile LifeCycle.State state = LifeCycle.State.INITIALIZED;
>>> >
>>> >     protected boolean equalsImpl(final Object obj) {
>>> >
>>> 
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
>>> For additional commands, e-mail: log4j-dev-help@logging.apache.org
>>> 
>> 
>> 
>> 
>> -- 
>> E-Mail: garydgregory@gmail.com | ggregory@apache.org 
>> Java Persistence with Hibernate, Second Edition 
>> JUnit in Action, Second Edition 
>> Spring Batch in Action 
>> Blog: http://garygregory.wordpress.com 
>> Home: http://garygregory.com/
>> Tweet! http://twitter.com/GaryGregory
> 
> 
> 
> -- 
> Matt Sicker <bo...@gmail.com>

Re: [1/2] logging-log4j2 git commit: Add org.apache.logging.log4j.core.AbstractLifeCycle.getLogger()

Posted by Matt Sicker <bo...@gmail.com>.
I can never remember when a class inherits a StatusLogger anyways, so it
generally seems a bit easier to just add the static field when used.

On 18 November 2016 at 22:15, Gary Gregory <ga...@gmail.com> wrote:

> But... from a provider's POV, like when I implement a custom Appender, it
> seems cleaner and more OO to call getLogger() than to access the static var
> directly. Now that I think about it, calling it getStatusLogger() would be
> even better.
>
> WDYT?
>
> Gary
>
>
> On Fri, Nov 18, 2016 at 8:10 PM, Remko Popma <re...@gmail.com>
> wrote:
>
>> Why? I prefer to keep the constant: that makes it clearer that this is a
>> status logger for internal use.
>>
>> Sent from my iPhone
>>
>> > On 19 Nov 2016, at 3:54, ggregory@apache.org wrote:
>> >
>> > Repository: logging-log4j2
>> > Updated Branches:
>> >  refs/heads/master 551cf8399 -> ee6f50d4c
>> >
>> >
>> > Add org.apache.logging.log4j.core.AbstractLifeCycle.getLogger()
>> >
>> > Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
>> > Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit
>> /261aba82
>> > Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/2
>> 61aba82
>> > Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/2
>> 61aba82
>> >
>> > Branch: refs/heads/master
>> > Commit: 261aba82b77f9f7fa6fe049d8f38a9311e442d89
>> > Parents: b5662cf
>> > Author: Gary Gregory <gg...@apache.org>
>> > Authored: Fri Nov 18 10:53:35 2016 -0800
>> > Committer: Gary Gregory <gg...@apache.org>
>> > Committed: Fri Nov 18 10:53:35 2016 -0800
>> >
>> > ----------------------------------------------------------------------
>> > .../org/apache/logging/log4j/core/AbstractLifeCycle.java    | 9
>> +++++++++
>> > 1 file changed, 9 insertions(+)
>> > ----------------------------------------------------------------------
>> >
>> >
>> > http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/2
>> 61aba82/log4j-core/src/main/java/org/apache/logging/log4j/co
>> re/AbstractLifeCycle.java
>> > ----------------------------------------------------------------------
>> > diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/AbstractLifeCycle.java
>> b/log4j-core/src/main/java/org/apache/logging/log4j/core/Abs
>> tractLifeCycle.java
>> > index dc720fd..c2df135 100644
>> > --- a/log4j-core/src/main/java/org/apache/logging/log4j/core/Abs
>> tractLifeCycle.java
>> > +++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/Abs
>> tractLifeCycle.java
>> > @@ -37,6 +37,15 @@ public class AbstractLifeCycle implements LifeCycle2
>> {
>> >      */
>> >     protected static final org.apache.logging.log4j.Logger LOGGER =
>> StatusLogger.getLogger();
>> >
>> > +    /**
>> > +     * Gets the status logger.
>> > +     *
>> > +     * @return the status logger.
>> > +     */
>> > +    protected static org.apache.logging.log4j.Logger getLogger() {
>> > +        return LOGGER;
>> > +    }
>> > +
>> >     private volatile LifeCycle.State state =
>> LifeCycle.State.INITIALIZED;
>> >
>> >     protected boolean equalsImpl(final Object obj) {
>> >
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
>> For additional commands, e-mail: log4j-dev-help@logging.apache.org
>>
>>
>
>
> --
> 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
>



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

Re: [1/2] logging-log4j2 git commit: Add org.apache.logging.log4j.core.AbstractLifeCycle.getLogger()

Posted by Gary Gregory <ga...@gmail.com>.
This class is the root of all of classes. I'm not saying we should add this
method to all root classes. I just see it as useful here because I have a
few custom Appenders.

Gary

On Fri, Nov 18, 2016 at 11:12 PM, Remko Popma <re...@gmail.com> wrote:

> If we end up providing this protected method in all abstract classes
> instead of simply doing a static import of StatusLogger.getLogger(),
> that would be silly...
>
> Sent from my iPhone
>
> On 19 Nov 2016, at 15:30, Gary Gregory <ga...@gmail.com> wrote:
>
> On Fri, Nov 18, 2016 at 8:58 PM, Remko Popma <re...@gmail.com>
> wrote:
>
>> getStatusLogger() is a much better name.
>> Somehow it feels like the wrong direction though. Do we really need to
>> build anything new here?
>> Wouldn't it be cleaner for components to static import the
>> StatusLogger.getLogger() method, for example?
>>
>
> That another approach, sure. I guess it's a matter of style. I'm going to
> rename getLogger() to getStatusLogger() for now. If we provide the method,
> the custom code does not need to import anything so that's less boiler
> plate code to add which is nice.
>
> Gary
>
>
>>
>> On Saturday, November 19, 2016, Gary Gregory <ga...@gmail.com>
>> wrote:
>>
>>> But... from a provider's POV, like when I implement a custom Appender,
>>> it seems cleaner and more OO to call getLogger() than to access the static
>>> var directly. Now that I think about it, calling it getStatusLogger() would
>>> be even better.
>>>
>>> WDYT?
>>>
>>> Gary
>>>
>>>
>>> On Fri, Nov 18, 2016 at 8:10 PM, Remko Popma <re...@gmail.com>
>>> wrote:
>>>
>>>> Why? I prefer to keep the constant: that makes it clearer that this is
>>>> a status logger for internal use.
>>>>
>>>> Sent from my iPhone
>>>>
>>>> > On 19 Nov 2016, at 3:54, ggregory@apache.org wrote:
>>>> >
>>>> > Repository: logging-log4j2
>>>> > Updated Branches:
>>>> >  refs/heads/master 551cf8399 -> ee6f50d4c
>>>> >
>>>> >
>>>> > Add org.apache.logging.log4j.core.AbstractLifeCycle.getLogger()
>>>> >
>>>> > Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
>>>> > Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit
>>>> /261aba82
>>>> > Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/2
>>>> 61aba82
>>>> > Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/2
>>>> 61aba82
>>>> >
>>>> > Branch: refs/heads/master
>>>> > Commit: 261aba82b77f9f7fa6fe049d8f38a9311e442d89
>>>> > Parents: b5662cf
>>>> > Author: Gary Gregory <gg...@apache.org>
>>>> > Authored: Fri Nov 18 10:53:35 2016 -0800
>>>> > Committer: Gary Gregory <gg...@apache.org>
>>>> > Committed: Fri Nov 18 10:53:35 2016 -0800
>>>> >
>>>> > ------------------------------------------------------------
>>>> ----------
>>>> > .../org/apache/logging/log4j/core/AbstractLifeCycle.java    | 9
>>>> +++++++++
>>>> > 1 file changed, 9 insertions(+)
>>>> > ------------------------------------------------------------
>>>> ----------
>>>> >
>>>> >
>>>> > http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/2
>>>> 61aba82/log4j-core/src/main/java/org/apache/logging/log4j/co
>>>> re/AbstractLifeCycle.java
>>>> > ------------------------------------------------------------
>>>> ----------
>>>> > diff --git a/log4j-core/src/main/java/org
>>>> /apache/logging/log4j/core/AbstractLifeCycle.java
>>>> b/log4j-core/src/main/java/org/apache/logging/log4j/core/Abs
>>>> tractLifeCycle.java
>>>> > index dc720fd..c2df135 100644
>>>> > --- a/log4j-core/src/main/java/org/apache/logging/log4j/core/Abs
>>>> tractLifeCycle.java
>>>> > +++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/Abs
>>>> tractLifeCycle.java
>>>> > @@ -37,6 +37,15 @@ public class AbstractLifeCycle implements
>>>> LifeCycle2 {
>>>> >      */
>>>> >     protected static final org.apache.logging.log4j.Logger LOGGER =
>>>> StatusLogger.getLogger();
>>>> >
>>>> > +    /**
>>>> > +     * Gets the status logger.
>>>> > +     *
>>>> > +     * @return the status logger.
>>>> > +     */
>>>> > +    protected static org.apache.logging.log4j.Logger getLogger() {
>>>> > +        return LOGGER;
>>>> > +    }
>>>> > +
>>>> >     private volatile LifeCycle.State state =
>>>> LifeCycle.State.INITIALIZED;
>>>> >
>>>> >     protected boolean equalsImpl(final Object obj) {
>>>> >
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
>>>> For additional commands, e-mail: log4j-dev-help@logging.apache.org
>>>>
>>>>
>>>
>>>
>>> --
>>> 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
>
>


-- 
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: [1/2] logging-log4j2 git commit: Add org.apache.logging.log4j.core.AbstractLifeCycle.getLogger()

Posted by Remko Popma <re...@gmail.com>.
If we end up providing this protected method in all abstract classes instead of simply doing a static import of StatusLogger.getLogger(), 
that would be silly...

Sent from my iPhone

> On 19 Nov 2016, at 15:30, Gary Gregory <ga...@gmail.com> wrote:
> 
>> On Fri, Nov 18, 2016 at 8:58 PM, Remko Popma <re...@gmail.com> wrote:
>> getStatusLogger() is a much better name. 
>> Somehow it feels like the wrong direction though. Do we really need to build anything new here?
>> Wouldn't it be cleaner for components to static import the StatusLogger.getLogger() method, for example?
> 
> That another approach, sure. I guess it's a matter of style. I'm going to rename getLogger() to getStatusLogger() for now. If we provide the method, the custom code does not need to import anything so that's less boiler plate code to add which is nice.
> 
> Gary
>  
>> 
>>> On Saturday, November 19, 2016, Gary Gregory <ga...@gmail.com> wrote:
>>> But... from a provider's POV, like when I implement a custom Appender, it seems cleaner and more OO to call getLogger() than to access the static var directly. Now that I think about it, calling it getStatusLogger() would be even better. 
>>> 
>>> WDYT?
>>> 
>>> Gary
>>> 
>>> 
>>>> On Fri, Nov 18, 2016 at 8:10 PM, Remko Popma <re...@gmail.com> wrote:
>>>> Why? I prefer to keep the constant: that makes it clearer that this is a status logger for internal use.
>>>> 
>>>> Sent from my iPhone
>>>> 
>>>> > On 19 Nov 2016, at 3:54, ggregory@apache.org wrote:
>>>> >
>>>> > Repository: logging-log4j2
>>>> > Updated Branches:
>>>> >  refs/heads/master 551cf8399 -> ee6f50d4c
>>>> >
>>>> >
>>>> > Add org.apache.logging.log4j.core.AbstractLifeCycle.getLogger()
>>>> >
>>>> > Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
>>>> > Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/261aba82
>>>> > Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/261aba82
>>>> > Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/261aba82
>>>> >
>>>> > Branch: refs/heads/master
>>>> > Commit: 261aba82b77f9f7fa6fe049d8f38a9311e442d89
>>>> > Parents: b5662cf
>>>> > Author: Gary Gregory <gg...@apache.org>
>>>> > Authored: Fri Nov 18 10:53:35 2016 -0800
>>>> > Committer: Gary Gregory <gg...@apache.org>
>>>> > Committed: Fri Nov 18 10:53:35 2016 -0800
>>>> >
>>>> > ----------------------------------------------------------------------
>>>> > .../org/apache/logging/log4j/core/AbstractLifeCycle.java    | 9 +++++++++
>>>> > 1 file changed, 9 insertions(+)
>>>> > ----------------------------------------------------------------------
>>>> >
>>>> >
>>>> > http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/261aba82/log4j-core/src/main/java/org/apache/logging/log4j/core/AbstractLifeCycle.java
>>>> > ----------------------------------------------------------------------
>>>> > diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/AbstractLifeCycle.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/AbstractLifeCycle.java
>>>> > index dc720fd..c2df135 100644
>>>> > --- a/log4j-core/src/main/java/org/apache/logging/log4j/core/AbstractLifeCycle.java
>>>> > +++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/AbstractLifeCycle.java
>>>> > @@ -37,6 +37,15 @@ public class AbstractLifeCycle implements LifeCycle2 {
>>>> >      */
>>>> >     protected static final org.apache.logging.log4j.Logger LOGGER = StatusLogger.getLogger();
>>>> >
>>>> > +    /**
>>>> > +     * Gets the status logger.
>>>> > +     *
>>>> > +     * @return the status logger.
>>>> > +     */
>>>> > +    protected static org.apache.logging.log4j.Logger getLogger() {
>>>> > +        return LOGGER;
>>>> > +    }
>>>> > +
>>>> >     private volatile LifeCycle.State state = LifeCycle.State.INITIALIZED;
>>>> >
>>>> >     protected boolean equalsImpl(final Object obj) {
>>>> >
>>>> 
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
>>>> For additional commands, e-mail: log4j-dev-help@logging.apache.org
>>>> 
>>> 
>>> 
>>> 
>>> -- 
>>> E-Mail: garydgregory@gmail.com | ggregory@apache.org 
>>> Java Persistence with Hibernate, Second Edition 
>>> JUnit in Action, Second Edition 
>>> Spring Batch in Action 
>>> 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 
> JUnit in Action, Second Edition 
> Spring Batch in Action 
> Blog: http://garygregory.wordpress.com 
> Home: http://garygregory.com/
> Tweet! http://twitter.com/GaryGregory

Re: [1/2] logging-log4j2 git commit: Add org.apache.logging.log4j.core.AbstractLifeCycle.getLogger()

Posted by Gary Gregory <ga...@gmail.com>.
On Fri, Nov 18, 2016 at 8:58 PM, Remko Popma <re...@gmail.com> wrote:

> getStatusLogger() is a much better name.
> Somehow it feels like the wrong direction though. Do we really need to
> build anything new here?
> Wouldn't it be cleaner for components to static import the
> StatusLogger.getLogger() method, for example?
>

That another approach, sure. I guess it's a matter of style. I'm going to
rename getLogger() to getStatusLogger() for now. If we provide the method,
the custom code does not need to import anything so that's less boiler
plate code to add which is nice.

Gary


>
> On Saturday, November 19, 2016, Gary Gregory <ga...@gmail.com>
> wrote:
>
>> But... from a provider's POV, like when I implement a custom Appender, it
>> seems cleaner and more OO to call getLogger() than to access the static var
>> directly. Now that I think about it, calling it getStatusLogger() would be
>> even better.
>>
>> WDYT?
>>
>> Gary
>>
>>
>> On Fri, Nov 18, 2016 at 8:10 PM, Remko Popma <re...@gmail.com>
>> wrote:
>>
>>> Why? I prefer to keep the constant: that makes it clearer that this is a
>>> status logger for internal use.
>>>
>>> Sent from my iPhone
>>>
>>> > On 19 Nov 2016, at 3:54, ggregory@apache.org wrote:
>>> >
>>> > Repository: logging-log4j2
>>> > Updated Branches:
>>> >  refs/heads/master 551cf8399 -> ee6f50d4c
>>> >
>>> >
>>> > Add org.apache.logging.log4j.core.AbstractLifeCycle.getLogger()
>>> >
>>> > Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
>>> > Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit
>>> /261aba82
>>> > Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/2
>>> 61aba82
>>> > Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/2
>>> 61aba82
>>> >
>>> > Branch: refs/heads/master
>>> > Commit: 261aba82b77f9f7fa6fe049d8f38a9311e442d89
>>> > Parents: b5662cf
>>> > Author: Gary Gregory <gg...@apache.org>
>>> > Authored: Fri Nov 18 10:53:35 2016 -0800
>>> > Committer: Gary Gregory <gg...@apache.org>
>>> > Committed: Fri Nov 18 10:53:35 2016 -0800
>>> >
>>> > ----------------------------------------------------------------------
>>> > .../org/apache/logging/log4j/core/AbstractLifeCycle.java    | 9
>>> +++++++++
>>> > 1 file changed, 9 insertions(+)
>>> > ----------------------------------------------------------------------
>>> >
>>> >
>>> > http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/2
>>> 61aba82/log4j-core/src/main/java/org/apache/logging/log4j/co
>>> re/AbstractLifeCycle.java
>>> > ----------------------------------------------------------------------
>>> > diff --git a/log4j-core/src/main/java/org
>>> /apache/logging/log4j/core/AbstractLifeCycle.java
>>> b/log4j-core/src/main/java/org/apache/logging/log4j/core/Abs
>>> tractLifeCycle.java
>>> > index dc720fd..c2df135 100644
>>> > --- a/log4j-core/src/main/java/org/apache/logging/log4j/core/Abs
>>> tractLifeCycle.java
>>> > +++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/Abs
>>> tractLifeCycle.java
>>> > @@ -37,6 +37,15 @@ public class AbstractLifeCycle implements
>>> LifeCycle2 {
>>> >      */
>>> >     protected static final org.apache.logging.log4j.Logger LOGGER =
>>> StatusLogger.getLogger();
>>> >
>>> > +    /**
>>> > +     * Gets the status logger.
>>> > +     *
>>> > +     * @return the status logger.
>>> > +     */
>>> > +    protected static org.apache.logging.log4j.Logger getLogger() {
>>> > +        return LOGGER;
>>> > +    }
>>> > +
>>> >     private volatile LifeCycle.State state =
>>> LifeCycle.State.INITIALIZED;
>>> >
>>> >     protected boolean equalsImpl(final Object obj) {
>>> >
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
>>> For additional commands, e-mail: log4j-dev-help@logging.apache.org
>>>
>>>
>>
>>
>> --
>> 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: [1/2] logging-log4j2 git commit: Add org.apache.logging.log4j.core.AbstractLifeCycle.getLogger()

Posted by Remko Popma <re...@gmail.com>.
getStatusLogger() is a much better name.
Somehow it feels like the wrong direction though. Do we really need to
build anything new here?
Wouldn't it be cleaner for components to static import the
StatusLogger.getLogger() method, for example?

On Saturday, November 19, 2016, Gary Gregory <ga...@gmail.com> wrote:

> But... from a provider's POV, like when I implement a custom Appender, it
> seems cleaner and more OO to call getLogger() than to access the static var
> directly. Now that I think about it, calling it getStatusLogger() would be
> even better.
>
> WDYT?
>
> Gary
>
>
> On Fri, Nov 18, 2016 at 8:10 PM, Remko Popma <remko.popma@gmail.com
> <javascript:_e(%7B%7D,'cvml','remko.popma@gmail.com');>> wrote:
>
>> Why? I prefer to keep the constant: that makes it clearer that this is a
>> status logger for internal use.
>>
>> Sent from my iPhone
>>
>> > On 19 Nov 2016, at 3:54, ggregory@apache.org
>> <javascript:_e(%7B%7D,'cvml','ggregory@apache.org');> wrote:
>> >
>> > Repository: logging-log4j2
>> > Updated Branches:
>> >  refs/heads/master 551cf8399 -> ee6f50d4c
>> >
>> >
>> > Add org.apache.logging.log4j.core.AbstractLifeCycle.getLogger()
>> >
>> > Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
>> > Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit
>> /261aba82
>> > Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/2
>> 61aba82
>> > Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/2
>> 61aba82
>> >
>> > Branch: refs/heads/master
>> > Commit: 261aba82b77f9f7fa6fe049d8f38a9311e442d89
>> > Parents: b5662cf
>> > Author: Gary Gregory <ggregory@apache.org
>> <javascript:_e(%7B%7D,'cvml','ggregory@apache.org');>>
>> > Authored: Fri Nov 18 10:53:35 2016 -0800
>> > Committer: Gary Gregory <ggregory@apache.org
>> <javascript:_e(%7B%7D,'cvml','ggregory@apache.org');>>
>> > Committed: Fri Nov 18 10:53:35 2016 -0800
>> >
>> > ----------------------------------------------------------------------
>> > .../org/apache/logging/log4j/core/AbstractLifeCycle.java    | 9
>> +++++++++
>> > 1 file changed, 9 insertions(+)
>> > ----------------------------------------------------------------------
>> >
>> >
>> > http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/2
>> 61aba82/log4j-core/src/main/java/org/apache/logging/log4j/co
>> re/AbstractLifeCycle.java
>> > ----------------------------------------------------------------------
>> > diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/AbstractLifeCycle.java
>> b/log4j-core/src/main/java/org/apache/logging/log4j/core/Abs
>> tractLifeCycle.java
>> > index dc720fd..c2df135 100644
>> > --- a/log4j-core/src/main/java/org/apache/logging/log4j/core/Abs
>> tractLifeCycle.java
>> > +++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/Abs
>> tractLifeCycle.java
>> > @@ -37,6 +37,15 @@ public class AbstractLifeCycle implements LifeCycle2
>> {
>> >      */
>> >     protected static final org.apache.logging.log4j.Logger LOGGER =
>> StatusLogger.getLogger();
>> >
>> > +    /**
>> > +     * Gets the status logger.
>> > +     *
>> > +     * @return the status logger.
>> > +     */
>> > +    protected static org.apache.logging.log4j.Logger getLogger() {
>> > +        return LOGGER;
>> > +    }
>> > +
>> >     private volatile LifeCycle.State state =
>> LifeCycle.State.INITIALIZED;
>> >
>> >     protected boolean equalsImpl(final Object obj) {
>> >
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
>> <javascript:_e(%7B%7D,'cvml','log4j-dev-unsubscribe@logging.apache.org');>
>> For additional commands, e-mail: log4j-dev-help@logging.apache.org
>> <javascript:_e(%7B%7D,'cvml','log4j-dev-help@logging.apache.org');>
>>
>>
>
>
> --
> E-Mail: garydgregory@gmail.com
> <javascript:_e(%7B%7D,'cvml','garydgregory@gmail.com');> | ggregory@apache.org
> <javascript:_e(%7B%7D,'cvml','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: [1/2] logging-log4j2 git commit: Add org.apache.logging.log4j.core.AbstractLifeCycle.getLogger()

Posted by Gary Gregory <ga...@gmail.com>.
But... from a provider's POV, like when I implement a custom Appender, it
seems cleaner and more OO to call getLogger() than to access the static var
directly. Now that I think about it, calling it getStatusLogger() would be
even better.

WDYT?

Gary


On Fri, Nov 18, 2016 at 8:10 PM, Remko Popma <re...@gmail.com> wrote:

> Why? I prefer to keep the constant: that makes it clearer that this is a
> status logger for internal use.
>
> Sent from my iPhone
>
> > On 19 Nov 2016, at 3:54, ggregory@apache.org wrote:
> >
> > Repository: logging-log4j2
> > Updated Branches:
> >  refs/heads/master 551cf8399 -> ee6f50d4c
> >
> >
> > Add org.apache.logging.log4j.core.AbstractLifeCycle.getLogger()
> >
> > Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
> > Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/
> commit/261aba82
> > Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/
> 261aba82
> > Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/
> 261aba82
> >
> > Branch: refs/heads/master
> > Commit: 261aba82b77f9f7fa6fe049d8f38a9311e442d89
> > Parents: b5662cf
> > Author: Gary Gregory <gg...@apache.org>
> > Authored: Fri Nov 18 10:53:35 2016 -0800
> > Committer: Gary Gregory <gg...@apache.org>
> > Committed: Fri Nov 18 10:53:35 2016 -0800
> >
> > ----------------------------------------------------------------------
> > .../org/apache/logging/log4j/core/AbstractLifeCycle.java    | 9
> +++++++++
> > 1 file changed, 9 insertions(+)
> > ----------------------------------------------------------------------
> >
> >
> > http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/
> 261aba82/log4j-core/src/main/java/org/apache/logging/log4j/
> core/AbstractLifeCycle.java
> > ----------------------------------------------------------------------
> > diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/AbstractLifeCycle.java
> b/log4j-core/src/main/java/org/apache/logging/log4j/core/
> AbstractLifeCycle.java
> > index dc720fd..c2df135 100644
> > --- a/log4j-core/src/main/java/org/apache/logging/log4j/core/
> AbstractLifeCycle.java
> > +++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/
> AbstractLifeCycle.java
> > @@ -37,6 +37,15 @@ public class AbstractLifeCycle implements LifeCycle2 {
> >      */
> >     protected static final org.apache.logging.log4j.Logger LOGGER =
> StatusLogger.getLogger();
> >
> > +    /**
> > +     * Gets the status logger.
> > +     *
> > +     * @return the status logger.
> > +     */
> > +    protected static org.apache.logging.log4j.Logger getLogger() {
> > +        return LOGGER;
> > +    }
> > +
> >     private volatile LifeCycle.State state = LifeCycle.State.INITIALIZED;
> >
> >     protected boolean equalsImpl(final Object obj) {
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-dev-help@logging.apache.org
>
>


-- 
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