Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 84D3C200B6B for ; Fri, 26 Aug 2016 06:58:54 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 83370160ABD; Fri, 26 Aug 2016 04:58:54 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 7AC14160AA5 for ; Fri, 26 Aug 2016 06:58:53 +0200 (CEST) Received: (qmail 33536 invoked by uid 500); 26 Aug 2016 04:58:52 -0000 Mailing-List: contact log4j-dev-help@logging.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Log4J Developers List" Reply-To: "Log4J Developers List" Delivered-To: mailing list log4j-dev@logging.apache.org Received: (qmail 33526 invoked by uid 99); 26 Aug 2016 04:58:52 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 26 Aug 2016 04:58:52 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id 274181A10F1 for ; Fri, 26 Aug 2016 04:58:52 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 1.98 X-Spam-Level: * X-Spam-Status: No, score=1.98 tagged_above=-999 required=6.31 tests=[HTML_MESSAGE=2, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01] autolearn=disabled Received: from mx2-lw-us.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id rKhKIVWzThi1 for ; Fri, 26 Aug 2016 04:58:50 +0000 (UTC) Received: from smtp694.redcondor.net (smtp694.redcondor.net [208.80.206.94]) by mx2-lw-us.apache.org (ASF Mail Server at mx2-lw-us.apache.org) with ESMTPS id C5DEC5F2F0 for ; Fri, 26 Aug 2016 04:58:49 +0000 (UTC) Received: from mailproxy12.neonova.net ([137.118.22.77]) by smtp694.redcondor.net ({c8ad8081-e921-4f15-9a53-034744fe478f}) via TCP (outbound) with ESMTP id 20160826045848443_0694 for ; Fri, 26 Aug 2016 04:58:48 +0000 X-RC-FROM: X-RC-RCPT: Received: from [192.168.1.6] (ip72-201-43-179.ph.ph.cox.net [72.201.43.179]) (Authenticated sender: ralph.goers@dslextreme.com) by mailproxy12.neonova.net (Postfix) with ESMTPA id 6750C360097 for ; Fri, 26 Aug 2016 00:58:44 -0400 (EDT) From: Ralph Goers Content-Type: multipart/alternative; boundary="Apple-Mail=_BBEB1F6D-65AE-4E74-B018-C29C100267EB" Message-Id: <84254C23-8B91-444E-9F8F-4B0100F7ACD3@dslextreme.com> Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) Subject: Re: Tying up loose ends with AbstractConfiguration.AbstractConfiguration(LoggerContext, ConfigurationSource) Date: Thu, 25 Aug 2016 21:58:43 -0700 References: To: Log4J Developers List In-Reply-To: X-Mailer: Apple Mail (2.3124) X-DLP-OUTBOUND: 137.118.22.64/27 X-MAG-OUTBOUND: greymail.redcondor.net@137.118.22.64/27 archived-at: Fri, 26 Aug 2016 04:58:54 -0000 --Apple-Mail=_BBEB1F6D-65AE-4E74-B018-C29C100267EB Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 CompositeConfiguration doesn=E2=80=99t look correct to me. It makes = sense for it to have a null source, but I=E2=80=99m not sure why it = should have a null LoggerContext.I think it should be: super(configurations.get(0).getLoggerContext(), = ConfigurationSource.NULL_SOURCE); Either that or getLoggerContext() should do that. Ralph > On Aug 25, 2016, at 9:03 PM, Gary Gregory = wrote: >=20 > [oops, sent too soon] >=20 > Hi All: >=20 > I'd like to tie up a loose end with callers of = AbstractConfiguration.AbstractConfiguration(LoggerContext, = ConfigurationSource) >=20 > There are four call sites that do this: >=20 > super(null, ConfigurationSource.NULL_SOURCE); >=20 > These are: > - = org.apache.logging.log4j.core.BasicConfigurationFactory.BasicConfiguration= .BasicConfiguration() > - = org.apache.logging.log4j.core.config.DefaultConfiguration.DefaultConfigura= tion() > - = org.apache.logging.log4j.core.config.NullConfiguration.NullConfiguration()= > - = org.apache.logging.log4j.core.config.composite.CompositeConfiguration.Comp= ositeConfiguration(List) >=20 > I am worried about this last one. >=20 > So I cannot null check the logger context in the AbstractConfiguration = ctor: >=20 > protected AbstractConfiguration(LoggerContext loggerContext, final = ConfigurationSource configurationSource) { > this.loggerContext =3D new WeakReference<>(loggerContext); > // The loggerContext is null for the NullConfiguration class. > // this.loggerContext =3D new = WeakReference(Objects.requireNonNull(loggerContext, "loggerContext is = null")); > this.configurationSource =3D = Objects.requireNonNull(configurationSource, "configurationSource is = null"); > ... > } >=20 > There are a couple of call sites where we could pass in a LC but we'd = need to add the LC to ctor for classes listed above. The default configs = usually include just console logging, but is that straight to the = console or via a ConsoleAppender? >=20 > I could even see adding a ctor = AbstractConfiguration.AbstractConfiguration(NullConfiguration) to make = it obvious that this is the only way is OK to pass null for the logger = context. Then the NullConfiguration ctor does not need to pass null. >=20 > Thoughts? >=20 > Gary >=20 > ---------- Forwarded message ---------- > From: Gary Gregory > > Date: Thu, Aug 25, 2016 at 8:54 PM > Subject: Tying up loose ends with = AbstractConfiguration.AbstractConfiguration(LoggerContext, = ConfigurationSource) > To: Log4J Developers List > >=20 >=20 > Hi All: >=20 > I'd like to tied up some loose end with Tying up loose ends with = AbstractConfiguration.AbstractConfiguration(LoggerContext, = ConfigurationSource) >=20 > There are three call sites that do this: >=20 >=20 > --=20 > 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 = =20 > Home: http://garygregory.com/ > Tweet! http://twitter.com/GaryGregory >=20 >=20 > --=20 > 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 = =20 > Home: http://garygregory.com/ > Tweet! http://twitter.com/GaryGregory --Apple-Mail=_BBEB1F6D-65AE-4E74-B018-C29C100267EB Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8
CompositeConfiguration doesn=E2=80=99t look = correct to me. It makes sense for it to have a null source, but I=E2=80=99= m not sure why it should have a null LoggerContext.I think it should = be:

super(configurations.get(0).getLoggerContext(), = ConfigurationSource.NULL_SOURCE);

Either that or getLoggerContext() = should do that.

Ralph

On Aug 25, 2016, at 9:03 PM, Gary Gregory = <garydgregory@gmail.com> wrote:

[oops, sent too soon]

Hi All:

I'd= like to tie up a loose end with callers of AbstractConfiguration.AbstractConfiguration(LoggerContext, = ConfigurationSource)

There are four call sites that do this:

super(null, = ConfigurationSource.NULL_SOURCE);

These are:
- org.apache.logging.log4j.core.BasicConfigurationFactory.= BasicConfiguration.BasicConfiguration()
- org.apache.logging.log4j.core.config.DefaultConfiguratio= n.DefaultConfiguration()
- org.apache.logging.log4j.core.config.NullConfiguration.N= ullConfiguration()
- org.apache.logging.log4j.core.config.composite.Composite= Configuration.CompositeConfiguration(List<? extends = AbstractConfiguration>)

I am worried about this last one.

So I cannot null check the logger = context in the AbstractConfiguration ctor:

    protected = AbstractConfiguration(LoggerContext loggerContext, final = ConfigurationSource configurationSource) {
  =       this.loggerContext =3D new = WeakReference<>(loggerContext);
    =     // The loggerContext is null for the NullConfiguration = class.
        // = this.loggerContext =3D new = WeakReference(Objects.requireNonNull(loggerContext, "loggerContext is = null"));
        = this.configurationSource =3D Objects.requireNonNull(configurationSource, = "configurationSource is null");
    =     ...
    }

There are a couple of = call sites where we could pass in a LC but we'd need to add the LC to = ctor for classes listed above. The default configs usually include just = console logging, but is that straight to the console or via a = ConsoleAppender?

I could even see adding a ctor AbstractConfiguration.AbstractConfiguration(NullConfiguration) to make it obvious = that this is the only way is OK to pass null for the logger context. = Then the NullConfiguration ctor does not need to pass null.

Thoughts?

Gary

---------- = Forwarded message ----------
From: Gary Gregory <garydgregory@gmail.com>
Date: = Thu, Aug 25, 2016 at 8:54 PM
Subject: Tying up loose ends = with AbstractConfiguration.AbstractConfiguration(LoggerContext, = ConfigurationSource)
To: Log4J Developers List <log4j-dev@logging.apache.org>


Hi All:

I'd like to tied up some = loose end with Tying up loose ends with AbstractConfiguration.AbstractConfiguration(LoggerContext, = ConfigurationSource)

There are three call sites that do this:



--

= --Apple-Mail=_BBEB1F6D-65AE-4E74-B018-C29C100267EB--