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 <boa...@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 <garydgreg...@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.po...@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, ggreg...@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 <ggreg...@apache.org> >>> > Authored: Fri Nov 18 10:53:35 2016 -0800 >>> > Committer: Gary Gregory <ggreg...@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-unsubscr...@logging.apache.org >>> For additional commands, e-mail: log4j-dev-h...@logging.apache.org >>> >> >> >> >> -- >> E-Mail: garydgreg...@gmail.com | ggreg...@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 <boa...@gmail.com>