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 1607C200B6F for ; Wed, 10 Aug 2016 07:09:22 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 149BB160AAD; Wed, 10 Aug 2016 05:09:22 +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 0D428160AA5 for ; Wed, 10 Aug 2016 07:09:20 +0200 (CEST) Received: (qmail 24064 invoked by uid 500); 10 Aug 2016 05:09:20 -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 24051 invoked by uid 99); 10 Aug 2016 05:09:20 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd4-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 10 Aug 2016 05:09:20 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd4-us-west.apache.org (ASF Mail Server at spamd4-us-west.apache.org) with ESMTP id A62D0C0455 for ; Wed, 10 Aug 2016 05:09:19 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd4-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 1.179 X-Spam-Level: * X-Spam-Status: No, score=1.179 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HTML_MESSAGE=2, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_PASS=-0.001] autolearn=disabled Authentication-Results: spamd4-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd4-us-west.apache.org [10.40.0.11]) (amavisd-new, port 10024) with ESMTP id jpxd44-f71ou for ; Wed, 10 Aug 2016 05:09:17 +0000 (UTC) Received: from mail-ua0-f169.google.com (mail-ua0-f169.google.com [209.85.217.169]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTPS id EDCC95F29A for ; Wed, 10 Aug 2016 05:09:16 +0000 (UTC) Received: by mail-ua0-f169.google.com with SMTP id n59so52151084uan.2 for ; Tue, 09 Aug 2016 22:09:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=rIvGujs/QgPYfTqgcpAkaOtsVtT59HXmr1D4UKLAa7M=; b=t7JzPl/Is75HrtZ44gdyaKUn/+KJIihjqlmbM6LY2Yg89YI/fXhxoigpJXZBH3L8Yx C1qWuUYBWHMtek60idzdZHp2qYfYnXK2F/gHJKiG8jTQU3wDVoQ0T9SjErmGviWY7vh0 pSXdf7znniszz6NXD4bApzmuA+6C+AMBu09HOk4DDQQuT8LfqeRryudie0jcM3oNZiiC VwKi9wS+Z2DyKvQ9A6785LMEmdHLQnfTysqjdGSIeN+SbqaCVwWm27VLs5QhBcchKe+o Z/RWJCi/i4O28h2WJDgIAStzqVa+QUBYCFSPmAxg3qvpHzvcwQNrYFOvlux8Y2cpfS4/ qKjw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to; bh=rIvGujs/QgPYfTqgcpAkaOtsVtT59HXmr1D4UKLAa7M=; b=BArG9H/xV5Egw+INJufO1eANhJwMUV/yac+9yE1Q1jwjRduHgEoALjv916R9f8jRCh ao11eVuuPG00kyU/+MqixtD5I98QUw0H+z8lRX/LlZ8Mf/xs7CzqsUgzoky2pbBsU+46 n0pWMoxLPN7QNsVSZXn2ftvTj8JpQc/WJub/7wj7YfP+hjVNTBj/dnRrkXXQiKWdsZtC X2BeRNJNIIwfyPG95rM9xWwWeFHgox0aRKYIzzzy5nf1aNAmqaSI8CMc7JUtI7O3L7iZ CxivAUaiceVymBnT6oFnK8QQA6OO7YTbJOyMWzGkGLwvLqApruqAzGkdczlHHb+Q+trU BwcQ== X-Gm-Message-State: AEkoout6otA9ZaCUUTImJyW2Gl8NSYPwmQETUbUgAps+eGcN0GBl9AVCU2Msai25Z3IBkqzlax4yuc5N+Syzng== X-Received: by 10.31.85.196 with SMTP id j187mr1047610vkb.12.1470805755100; Tue, 09 Aug 2016 22:09:15 -0700 (PDT) MIME-Version: 1.0 Received: by 10.103.129.23 with HTTP; Tue, 9 Aug 2016 22:09:14 -0700 (PDT) In-Reply-To: References: <3cb3dcb6dc86444a97be4a37b47c6cdf@git.apache.org> From: Matt Sicker Date: Wed, 10 Aug 2016 00:09:14 -0500 Message-ID: Subject: Re: logging-log4j2 git commit: [LOG4J2-1505] Create a Builder for FileAppender. Use @Required per Matt's suggestion. Thank you Matt! To: Log4J Developers List Content-Type: multipart/alternative; boundary=001a114e51d691018d0539b0a608 archived-at: Wed, 10 Aug 2016 05:09:22 -0000 --001a114e51d691018d0539b0a608 Content-Type: text/plain; charset=UTF-8 I believe it's the same basic behaviour (error message is logged, factory returns null). I can verify in code in like 9 hours from now, though. On 9 August 2016 at 17:26, Remko Popma wrote: > Does using the @Required annotation result in the same behavior? > > The old code logged an ERROR level message and returned null, so the > configuration for that appender was ignored. > > How does it behave now if a null name or filename is configured? > > Remko > > Sent from my iPhone > > > On 2016/08/09, at 4:54, ggregory@apache.org wrote: > > > > Repository: logging-log4j2 > > Updated Branches: > > refs/heads/master de528c5f8 -> 9401a1f1e > > > > > > [LOG4J2-1505] Create a Builder for FileAppender. Use @Required per > > Matt's suggestion. Thank you Matt! > > > > Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo > > Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/ > commit/9401a1f1 > > Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/ > 9401a1f1 > > Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/ > 9401a1f1 > > > > Branch: refs/heads/master > > Commit: 9401a1f1e52e271727c2b07a5b7aeafcb7f1768b > > Parents: de528c5 > > Author: Gary Gregory > > Authored: Mon Aug 8 12:54:49 2016 -0700 > > Committer: Gary Gregory > > Committed: Mon Aug 8 12:54:49 2016 -0700 > > > > ---------------------------------------------------------------------- > > .../apache/logging/log4j/core/appender/FileAppender.java | 11 > +++-------- > > 1 file changed, 3 insertions(+), 8 deletions(-) > > ---------------------------------------------------------------------- > > > > > > http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/ > 9401a1f1/log4j-core/src/main/java/org/apache/logging/log4j/ > core/appender/FileAppender.java > > ---------------------------------------------------------------------- > > diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/FileAppender.java > b/log4j-core/src/main/java/org/apache/logging/log4j/core/ > appender/FileAppender.java > > index 3f364cc..b13cb01 100644 > > --- a/log4j-core/src/main/java/org/apache/logging/log4j/core/ > appender/FileAppender.java > > +++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/ > appender/FileAppender.java > > @@ -28,6 +28,7 @@ import org.apache.logging.log4j.core.config.plugins. > PluginBuilderAttribute; > > import org.apache.logging.log4j.core.config.plugins. > PluginBuilderFactory; > > import org.apache.logging.log4j.core.config.plugins.PluginConfiguration; > > import org.apache.logging.log4j.core.config.plugins.PluginElement; > > +import org.apache.logging.log4j.core.config.plugins.validation. > constraints.Required; > > import org.apache.logging.log4j.core.layout.PatternLayout; > > import org.apache.logging.log4j.core.net.Advertiser; > > import org.apache.logging.log4j.core.util.Booleans; > > @@ -45,6 +46,7 @@ public final class FileAppender extends > AbstractOutputStreamAppender > public static class Builder implements org.apache.logging.log4j.core.util.Builder > { > > > > @PluginBuilderAttribute > > + @Required > > private String fileName; > > > > @PluginBuilderAttribute > > @@ -54,6 +56,7 @@ public final class FileAppender extends > AbstractOutputStreamAppender > private boolean locking; > > > > @PluginBuilderAttribute > > + @Required > > private String name; > > > > @PluginBuilderAttribute > > @@ -95,14 +98,6 @@ public final class FileAppender extends > AbstractOutputStreamAppender > if (!bufferedIo && bufferSize > 0) { > > LOGGER.warn("The bufferSize is set to {} but bufferedIo > is not true: {}", bufferSize, bufferedIo); > > } > > - if (name == null) { > > - LOGGER.error("No name provided for FileAppender"); > > - return null; > > - } > > - if (fileName == null) { > > - LOGGER.error("No filename provided for FileAppender > with name {}", name); > > - return null; > > - } > > if (layout == null) { > > layout = PatternLayout.createDefaultLayout(); > > } > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org > For additional commands, e-mail: log4j-dev-help@logging.apache.org > > -- Matt Sicker --001a114e51d691018d0539b0a608 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
I believe it's the same basic behaviour (error message= is logged, factory returns null). I can verify in code in like 9 hours fro= m now, though.

On 9 August 2016 at 17:26, Remko Popma <remko.popma@gmail.com&g= t; wrote:
Does using the @Required= annotation result in the same behavior?

The old code logged an ERROR level message and returned null, so the config= uration for that appender was ignored.

How does it behave now if a null name or filename is configured?

Remko

Sent from my iPhone

> On 2016/08/09, at 4:54, ggregor= y@apache.org wrote:
>
> Repository: logging-log4j2
> Updated Branches:
>=C2=A0 refs/heads/master de528c5f8 -> 9401a1f1e
>
>
> [LOG4J2-1505] Create a Builder for FileAppender. Use @Required per
> Matt's suggestion. Thank you Matt!
>
> Project: http://git-wip-us.apache.org= /repos/asf/logging-log4j2/repo
> Commit: http://git-wip-us.= apache.org/repos/asf/logging-log4j2/commit/9401a1f1
> Tree: http://git-wip-us.apac= he.org/repos/asf/logging-log4j2/tree/9401a1f1
> Diff: http://git-wip-us.apac= he.org/repos/asf/logging-log4j2/diff/9401a1f1
>
> Branch: refs/heads/master
> Commit: 9401a1f1e52e271727c2b07a5b7aeafcb7f1768b
> Parents: de528c5
> Author: Gary Gregory <ggrego= ry@apache.org>
> Authored: Mon Aug 8 12:54:49 2016 -0700
> Committer: Gary Gregory <ggr= egory@apache.org>
> Committed: Mon Aug 8 12:54:49 2016 -0700
>
> ------------------------------------------------------------= ----------
> .../apache/logging/log4j/core/appender/FileAppender.java | 11 +++= --------
> 1 file changed, 3 insertions(+), 8 deletions(-)
> ------------------------------------------------------------= ----------
>
>
> http://git-wip-us.apa= che.org/repos/asf/logging-log4j2/blob/9401a1f1/log4j-core/src/mai= n/java/org/apache/logging/log4j/core/appender/FileAppender.j= ava
> ------------------------------------------------------------= ----------
> diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/co= re/appender/FileAppender.java b/log4j-core/src/main/java/org/apac= he/logging/log4j/core/appender/FileAppender.java
> index 3f364cc..b13cb01 100644
> --- a/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/FileAppender.java
> +++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/FileAppender.java
> @@ -28,6 +28,7 @@ import org.apache.logging.log4j.core.config.plu= gins.PluginBuilderAttribute;
> import org.apache.logging.log4j.core.config.plugins.PluginBu= ilderFactory;
> import org.apache.logging.log4j.core.config.plugins.PluginCo= nfiguration;
> import org.apache.logging.log4j.core.config.plugins.PluginElement= ;
> +import org.apache.logging.log4j.core.config.plugins.validation.<= wbr>constraints.Required;
> import org.apache.logging.log4j.core.layout.PatternLayout;
> import org.apache.logging.log4j.core.net.Advertiser;
> import org.apache.logging.log4j.core.util.Booleans;
> @@ -45,6 +46,7 @@ public final class FileAppender extends AbstractOutp= utStreamAppender<FileManager
>=C2=A0 =C2=A0 =C2=A0public static class Builder implements org.apache.l= ogging.log4j.core.util.Builder<FileAppender> {
>
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0@PluginBuilderAttribute
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 @Required
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0private String fileName;
>
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0@PluginBuilderAttribute
> @@ -54,6 +56,7 @@ public final class FileAppender extends AbstractOutp= utStreamAppender<FileManager
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0private boolean locking;
>
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0@PluginBuilderAttribute
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 @Required
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0private String name;
>
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0@PluginBuilderAttribute
> @@ -95,14 +98,6 @@ public final class FileAppender extends AbstractOut= putStreamAppender<FileManager
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0if (!bufferedIo &&a= mp; bufferSize > 0) {
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0LOGGER.wa= rn("The bufferSize is set to {} but bufferedIo is not true: {}", = bufferSize, bufferedIo);
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0}
> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 if (name =3D=3D null) {
> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 LOGGER.error(= "No name provided for FileAppender");
> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 return null;<= br> > -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 }
> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 if (fileName =3D=3D null) {=
> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 LOGGER.error(= "No filename provided for FileAppender with name {}", name);
> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 return null;<= br> > -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 }
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0if (layout =3D=3D null)= {
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0layout = =3D PatternLayout.createDefaultLayout();
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0}
>

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




--
Matt Sicker <boards@gmail.com>=
--001a114e51d691018d0539b0a608--