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 EF1772009D9 for ; Thu, 19 May 2016 17:55:51 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id EDA46160A00; Thu, 19 May 2016 15:55:51 +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 1D05B1609AE for ; Thu, 19 May 2016 17:55:50 +0200 (CEST) Received: (qmail 84219 invoked by uid 500); 19 May 2016 15:55:50 -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 84209 invoked by uid 99); 19 May 2016 15:55:50 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 19 May 2016 15:55:50 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id D329BC34C7 for ; Thu, 19 May 2016 15:55:49 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 1.198 X-Spam-Level: * X-Spam-Status: No, score=1.198 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_H2=-0.001, SPF_PASS=-0.001] autolearn=disabled Authentication-Results: spamd1-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 (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id zjDX8eP1SWtg for ; Thu, 19 May 2016 15:55:47 +0000 (UTC) Received: from mail-qg0-f59.google.com (mail-qg0-f59.google.com [209.85.192.59]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTPS id 897BE5F56C for ; Thu, 19 May 2016 15:55:47 +0000 (UTC) Received: by mail-qg0-f59.google.com with SMTP id e35so17777849qge.0 for ; Thu, 19 May 2016 08:55:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:message-id:in-reply-to:references:subject :mime-version; bh=qf3bkXF/xClOuy+fNJ7+H2yZeqB3+JA32kcTD1R37xs=; b=GMBBkV80O7aMVy7uKzrw7qooXO1K1PRazYk340O3URV8DI1ZMeYlO38Mhxjg0v7yMt pCx4xbWrFeOJFRme6pde5ZdrthxAZyogdoZRt75FYmVn49tLxkBIyM/VH7Wcf7VHS9h5 dDfN11MTG6SMTtFL3TB4G/fO5Wb4AVv+r1C+AP4N71o3nq1ZLiY0RmdIUgfKyxFwQi1S IsVVg0WGR0Lh014tsaBnKpk+ZE9Hlw99z10hoxIClg7q+cdDjDb4tIq8g3e2DBuRrZtr 4iLusyoqcSuq6iRaK3+TkVryOoBRMQlQUDnMBky4qnSmV5y1xIRnYhW3aHf4KJPu1JWv 1ddw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:cc:message-id:in-reply-to :references:subject:mime-version; bh=qf3bkXF/xClOuy+fNJ7+H2yZeqB3+JA32kcTD1R37xs=; b=cOveIF3lMcl7BEDX+CdJDmhlqAdpHC60qff4yYlKRUug/to7DwgpGrbrFY2iggJTYb klS6LGZ/UloSH+c6jg0NThmKEZ5Wcd7pNtRM4TmLyL65C4I3NW0W5p+pKaawXxL3j0qa lsWEIj1a9CnHUinEIncfw9vqMfok7XgOLZlLEV0WNBkHbwhGEEb3pUiWZv62dCsvbgYJ vjCYIa/RWZB157BFa722VcjqZKHrv82izmWUgJLoWJLbk7YAyPZjf+Uz2AVzraLhHeeR aad9VURkvPDpXnR8qTfVfQDqKom/ZWQ0gP16lXhscTU0kLlx2fXvn5E5zHZfBZuDzFAI LxGQ== X-Gm-Message-State: AOPr4FXEBOi9EBxlxZMqBo5m57aDD1QkqIdFY/2vUJkNTpQaAjGGhsQpWSixCZhtnNCqI7XBMGh/ X-Received: by 10.140.101.170 with SMTP id u39mr1463435qge.11.1463673340724; Thu, 19 May 2016 08:55:40 -0700 (PDT) X-Google-Already-Archived: Yes X-Google-Already-Archived-Group-Id: 96d53ff93e X-Google-Doc-Id: e3c22db82475 X-Google-Thread-Id: 92579f8d1aa5a501 X-Google-Message-Url: http://groups.google.com/group/mechanical-sympathy/msg/e3c22db82475 X-Google-Thread-Url: http://groups.google.com/group/mechanical-sympathy/t/92579f8d1aa5a501 X-Google-Web-Client: true Date: Thu, 19 May 2016 08:55:40 -0700 (PDT) From: Remko Popma To: mechanical-sympathy Cc: log4j-dev@logging.apache.org Message-Id: <7359b8b5-1089-49ea-8737-6587f5b56c0f@googlegroups.com> In-Reply-To: References: <10013c64-b50f-43dd-a430-dd1ec637769c@googlegroups.com> <0aae8089-4ebd-4b19-96b4-ea4266683307@googlegroups.com> Subject: Re: Garbage-free Log4j docs preview MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_Part_353_542789893.1463673340367" X-Google-Token: EPzD97kF5PDuClP4sww0 X-Google-IP: 115.179.87.3 archived-at: Thu, 19 May 2016 15:55:52 -0000 ------=_Part_353_542789893.1463673340367 Content-Type: multipart/alternative; boundary="----=_Part_354_1103804740.1463673340367" ------=_Part_354_1103804740.1463673340367 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit After looking more closely I found that the org.slf4j.spi.LocationAwareLogger::log method is currently not implemented in a garbage-free manner in the log4j-slf4j-impl binding. It creates a new message object for each call. If there is interest we can address this in a future release. Other methods seem okay. On Thursday, May 19, 2016 at 4:57:10 PM UTC+9, Jerry Shea wrote: > > Ok thanks! > On 19 May 2016 5:10 pm, "Remko Popma" > > wrote: > >> On Thursday, May 19, 2016 at 11:10:45 AM UTC+9, Jerry Shea wrote: >> > This is fantastic, thanks for this Remko. >> > >> > >> > Can I ask a couple of questions? >> > 1. is log4j 2.6 designed to operate garbage-free when used as an SLF4J >> implementation too, or only with the native API? >> >> The log4j-slf4j-impl binding is trying to be garbage-free, but the SLF4J >> API only offers up to two parameters for a parameterized message. More than >> that uses varargs which creates a temporary object for the parameter array. >> The native Log4j 2.6 API has methods for up to ten unrolled parameters. >> >> Another consideration is that the native Log4j 2 API lets you log >> Objects, not just Strings. Any Object that implements CharSequence can be >> logged without creating garbage. >> >> You can also implement the log4j Message interface if you want to >> separate formatting from your business domain objects. >> >> Finally, the native Log4j 2 API has support for logging Java 8 lambdas >> (since 2.4). >> >> > 2. when do you expect log4j 2.6 to be released GA i.e. ready for >> production use? >> >> Barring any showstoppers, I expect it will be available in a week or so. >> >> ------=_Part_354_1103804740.1463673340367 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable
After looking more closely I found that the=C2=A0org.slf4j.spi.LocationAwareLogger::log=C2=A0method is currently not impleme= nted in a garbage-free manner in the=C2=A0log4j-slf4j-impl binding. It crea= tes a new message object for each call. If there is interest we can address= this in a future release. Other methods seem okay.=C2=A0


On Thursday, May 19, 2016 at 4:57:10 PM UTC+9, Jerry Shea wrote= :

Ok thanks!

On 19 May 2016 5:10 pm, "Remko Popma" = <r= emko...@gmail.com> wrote:
On Thursday, May 19, 2016 at 11:10:45 AM UTC+9, Jerry Shea wr= ote:
> This is fantastic, thanks for this Remko.
>
>
> Can I ask a couple of questions?
> 1. is log4j 2.6 designed to operate garbage-free when used as an SLF4J= implementation too, or only with the native API?

The log4j-slf4j-impl binding is trying to be garbage-free, but the SLF4J AP= I only offers up to two parameters for a parameterized message. More than t= hat uses varargs which creates a temporary object for the parameter array. = The native Log4j 2.6 API has methods for up to ten unrolled parameters.

Another consideration is that the native Log4j 2 API lets you log Objects, = not just Strings. Any Object that implements CharSequence can be logged wit= hout creating garbage.

You can also implement the log4j Message interface if you want to separate = formatting from your business domain objects.

Finally, the native Log4j 2 API has support for logging Java 8 lambdas (sin= ce 2.4).

> 2. when do you expect=C2=A0log4j 2.6=C2=A0to be released GA i.e. ready= for production use?

Barring any showstoppers, I expect it will be available in a week or so.
------=_Part_354_1103804740.1463673340367-- ------=_Part_353_542789893.1463673340367 Content-Type: text/plain; charset=us-ascii --------------------------------------------------------------------- To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org For additional commands, e-mail: log4j-dev-help@logging.apache.org ------=_Part_353_542789893.1463673340367--